Open Bug 2016387 Opened 1 month ago Updated 1 month ago

::selection is not inherited across trees

Categories

(Core :: Layout, defect, P3)

Firefox 147
defect

Tracking

()

Tracking Status
firefox147 --- affected
firefox148 --- affected
firefox149 --- affected

People

(Reporter: keithamus, Unassigned)

Details

Attachments

(1 file)

Attached file Test Case

In a page with a global ::selection style, shadowroots will not inherit background/foreground colors of the selection.

This is inconsistent with other browsers such as Chrome.

STR:

  1. Open the attached test case.
  2. Press Ctrl+A or otherwise select all the text.
  3. Observe the selection colors

Expected:

  • All selected text uses a hotpink backround with teal text.

Actual:

  • The text in the "light DOM" uses hotpink/teal, but the shadowdom nodes are selected with the default selection colors.

Chrome is as expected, Firefox 147-nightly (likely earlier also) is not.

Both Chrome and Safari allow propagation of ::selection styles into the Shadow DOM. I think Firefox should allow it too because a selection is generally not considered to be a part of an element, but part of the browser's UI and therefor needs no encapsulation.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: