[Webkit-unassigned] [Bug 225147] New: [selectors] :focus-visible and contenteditable

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 28 03:11:03 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225147

            Bug ID: 225147
           Summary: [selectors] :focus-visible and contenteditable
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rego at igalia.com
                CC: rniwa at webkit.org
            Blocks: 185859

This comes from a comment in a different bug:
https://bugs.webkit.org/show_bug.cgi?id=225075#c13

There we were talking about the condition in Element::shouldAlwaysHaveFocusVisibleWhenFocused().
And we were wondering if we should use isRootEditableElement() instead of isContentEditable().

I'm attaching an example like this:
    <style>
      :focus { border: solid thick magenta; }
      :focus-visible { background: cyan; } 
    </style>
    <div id="wrapper" contenteditable>
      <div>Inner DIV</div>
      <div id="target" tabindex="0">Inner DIV with tabindex</div>
      <div>Another inner DIV</div>
    </div>

Here the first time you click in DIV#target, the whole DIV#wrapper is focused. And the whole DIV#wrapper matches :focus-visible.
This time both isRootEditableElement() and isContentEditable() are true, because we're focusing DIV#wrapper.
The 2nd time we click in DIV#target, only DIV#target is focused, and only DIV#target matches :focus-visible.
Now isRootEditableElement() is false and isContentEditable() is true.

If we change the code to use isRootEditableElement(), then wewon't match :focus-visible in DIV#target in the 2nd click. So we'll be editing that element without matching :focus-visible which seems wrong.

Maybe the example should be different, or I'm missing some other combination.

Please Ryosuke share your thoughts. Thanks!


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=185859
[Bug 185859] [selectors] Support for Focus-Indicated Pseudo-class: `:focus-visible`
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210428/165f0236/attachment.htm>


More information about the webkit-unassigned mailing list