NEW 225147
[selectors] :focus-visible and contenteditable
https://bugs.webkit.org/show_bug.cgi?id=225147
Summary [selectors] :focus-visible and contenteditable
Manuel Rego Casasnovas
Reported 2021-04-28 03:11:03 PDT
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!
Attachments
Example (316 bytes, text/html)
2021-04-28 03:28 PDT, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2021-04-28 03:28:48 PDT
Radar WebKit Bug Importer
Comment 2 2021-05-05 03:12:14 PDT
Note You need to log in before you can comment on or make changes to this bug.