Closed Bug 1809379 Opened 1 year ago Closed 1 year ago

[CTW] Y coordinate incorrect for characters when textarea is scrolled

Categories

(Core :: Disability Access APIs, defect)

defect

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

(Whiteboard: [ctw-m4])

Attachments

(1 file)

Spun off bug 1801756 comment 33.

STR:

  1. Open this test case:
    data:text/html,<textarea style="height: 10px;">a%0ab%0ac
  2. Focus the textarea.
  3. Get the Accessible for the textarea.
  4. Call CharBounds on the textarea with offset 4. Note the coordinates.
  5. Move the caret to the last line by pressing down arrow twice.
  6. Call CharBounds on the textarea with offset 4.
    • Expected: The y coordinate should be smaller because this line has scrolled into view.
    • Actual: The y coordinate is the same as in step 4.

We use text leaf nodes to get text bounds. BoundsWithOffset already applies the scroll offset for ancestors, so I would've thought it should handle this already. However, it seems that the textarea cache doesn't have scroll-position. I wonder if there's a frame between the textarea frame and the text leaf frame that we're missing? Note that the text leaf Accessibles don't have scroll-position either.

Calling .scrollTop on the textarea using the web console returns a larger value when the textarea is scrolled. Element::ScrollTop ends up using GetScrollTargetFrame and GetScrollPositionCSSPixels. The a11y code uses GetScrollTargetFrame and GetScrollPosition (without CSSPixels) too. I confirmed that the scroll event is definitely firing and DocAccessible::HandleScroll is catching it, but we fail to get an Accessible. I'm now starting to suspect the event might be fired by an anonymous node inside the textarea or something like that.

Taking for now; we'll see how far I get.

Assignee: nobody → jteh

Yup, the event is coming from native anonymous content. I have a working fix, now just have to write a test.

Whiteboard: [ctw-m4]

textareas contain an anonymous div which fires the scroll event.
We don't have an Accessible for this div, so previously, we were just ignoring the scroll event.
Now, we'll redirect it to the textarea and get its Accessible.

Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/661be0caf687
If a scroll event is fired on inaccessible anonymous content, redirect it to the closest non-anonymous ancestor. r=morgan
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: