Closed Bug 1897956 Opened 1 month ago Closed 10 days ago

Text-Fragments: Set first text directive as `:target`

Categories

(Core :: DOM: Navigation, task)

task

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: jjaschke, Assigned: jjaschke)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

The first text directive needs to be set as :target element.

This bug is being worked on in parallel to bug 1897942, which depends on this bug.

This patch makes some adjustments to follow the spec more strictly by
separating highlighting a text fragment (ie. adding the ranges to a eTargetText Selection)
from scrolling to it.

Scrolling to the text fragment now follows the steps given in 0 more closely,
in particular now the closest common ancestor of the target range is being used
as :target element.

This change also sets the focus to the start of the first text fragment, as indicated by the spec.
This resets the normal selection on the page.
The wpt test in /css/css-pseudo/target-text-005.html is based on the idea of having a same-doc
text fragment navigation with a selection.
This test fails with this patch applied, because the selection is reset.
It is currently unclear what behavior is correct here, thus the test is kept for now.

Pushed by jjaschke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/aab98ffe0ee9
Text Fragments: Set text fragment as `:target`. r=farre,dom-core
Flags: needinfo?(jjaschke)
Depends on: 1903086
Pushed by jjaschke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/16203f0a9251
Text Fragments: Set text fragment as `:target`. r=farre,dom-core
Status: ASSIGNED → RESOLVED
Closed: 10 days ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
Flags: needinfo?(jjaschke)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: