IAccessibleTextSelectionContainer::setSelections includes entire content of embedded object if end offset refers to an embedded object
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox140 | --- | fixed |
People
(Reporter: Jamie, Assigned: Jamie)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
STR (with the NVDA screen reader):
- Open this test case:
data:text/html,<p>a<a href="/">b</a> - Enable native selection by pressing NVDA+shift+f10.
- Press control+home to move to the start of the document.
- Press shift+rightArrow to select "a".
- Press control+c to copy to the clipboard.
- Press NVDA+c to report the content of the clipboard.
- Expected: "a"
- Actual: "ab"
NVDA calls IAccessibleTextSelectionContainer::setSelections, passing it a range with (p, 0, p, 1), where p is the paragraph. (p, 1) refers to the embedded object for the link. Currently, our implementation of setSelections descends to the end when obtaining the TextLeafPoint for the end offset. That means the end point is offset 1 of the "b" text leaf, resulting in the "b" being selected. Since the end offset is exclusive, we probably shouldn't be descending to end in this case; we want the range to end right at the start of the text node.
| Assignee | ||
Comment 1•2 years ago
|
||
Descend to end isn't the only problem here. If you have a text leaf and an image, you get the same problem:
data:text/html,a<img src="https://via.placeholder.com/10x10" alt="b">
In this case, the end point is at offset 0 of the image, but DOM seems to treat this as including the image, even though the end point is exclusive. We'll need to tweak the DOM point to refer to the image using a child index in the parent rather than the image itself.
| Assignee | ||
Updated•11 months ago
|
| Assignee | ||
Comment 2•11 months ago
|
||
We did have support for IA2 testing when this was added.
However, because this interface is a relatively recent addition to the IA2 spec, it isn't included in the COM proxy dll included in Windows.
This means we can't run these tests without building and installing our own proxy DLL.
This has to be integrated into the Windows CI images, so we can't run these tests on CI for now and thus they're disabled on CI.
Even so, it's better to have local-only tests for this than no tests at all.
| Assignee | ||
Comment 3•11 months ago
|
||
When we descend to the end for an embedded object character, we get the position after the last character inside that embedded object.
This isn't what we want for selections because the end offset should be exclusive, not inclusive.
Descending to the end means we include the entire content of the embedded object instead of excluding it.
Instead, always descend to the start.
| Assignee | ||
Comment 4•11 months ago
|
||
For text nodes, DOM points use the character offset within the node itself, just like accessibility does.
For non-text nodes, DOM points use the child index within the parent to specify the position before or after the node.
Previously, TextLeafPoint::ToDOMPoint always used an offset within the node itself.
This meant that when the (exclusive) end point of a range was an image, we converted to a DOM point of offset 0 within the image.
As far as DOM is concerned, this includes the image.
This patch adjusts ToDOMPoint as appropriate.
As part of this, ToDOMPoint now returns a uint32_t instead of an int32_t.
This is because DOM offsets are actually uint32_t and calculating int32_t child indices is deprecated.
Comment 6•11 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/bcecb7e3d856
https://hg.mozilla.org/mozilla-central/rev/16652a9ee9f7
https://hg.mozilla.org/mozilla-central/rev/547c6d91f7e9
Updated•11 months ago
|
Description
•