Unify the accessibility code to set the caret
Categories
(Core :: Disability Access APIs, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox138 | --- | fixed |
People
(Reporter: Jamie, Assigned: Jamie)
References
(Blocks 2 open bugs)
Details
Attachments
(5 files)
There are two very different accessibility code paths for setting the caret: HyperTextAccessible::SetCaretOffset (used by IA2 and ATK) and TextLeafRange::SetSelection (used by Mac and UIA). The former performs some additional tasks which the latter does not: focusing the control, scrolling the selection into view and updating DOM nsFocusmanager. I think we should unify these so that we have a single code path, with SetCaretOffset being mostly a wrapper around SetSelection.
I started working on this in bug 1950785, thinking this solved a real bug. It turns out that my testing was incorrect and the bug I thought I spotted actually doesn't exist. 😳 However, I still think it makes sense to do this and I suspect it will make weird bugs in this area easier to manage in future.
| Assignee | ||
Comment 1•1 year ago
|
||
Previously, a caller had to first retrieve all selection ranges and then remove them individually.
This makes it awkward to perform a fairly common operation.
| Assignee | ||
Comment 2•1 year ago
|
||
HyperTextAccessible::SetSelectionRange (used by SetCaretOffset) performed these tasks, but TextLeafRange::SetSelection didn't.
This meant that the behaviour when setting the caret or selection was different for different OS APIs: IA2 and ATK use HyperTextAccessible::SetCaretOffset, while Mac and UIA use TextLeafRange::SetSelection.
While we aren't aware of any specific bugs impacting users, this is confusing at best and might result in obscure bugs in future.
See the code comments for details.
| Assignee | ||
Comment 3•1 year ago
|
||
TextLeafRange::SetSelection should now be the one place where all text selections are set.
Previously, we had a separate local implementation for SetCaretOffset which differed slightly from using TextLeafRange::SetSelection.
Now, these should be equivalent, so there's no need for this separate local implementation.
| Assignee | ||
Comment 4•1 year ago
|
||
There were still some callers of SetSelectionRange, but these can now all be trivially converted to use SetSelectionBoundsAt (which calls TextLeafRange::SetSelection).
| Assignee | ||
Comment 5•1 year ago
|
||
Comment 7•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/f30edc52101d
https://hg.mozilla.org/mozilla-central/rev/270f08d9691e
https://hg.mozilla.org/mozilla-central/rev/9e306ea56c79
https://hg.mozilla.org/mozilla-central/rev/5f90dc08ec62
https://hg.mozilla.org/mozilla-central/rev/23a8b787c70c
| Assignee | ||
Updated•11 months ago
|
Description
•