Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfocusing steps should account for delegatesFocus somehow #7070

Closed
emilio opened this issue Sep 14, 2021 · 3 comments · Fixed by #7079
Closed

Unfocusing steps should account for delegatesFocus somehow #7070

emilio opened this issue Sep 14, 2021 · 3 comments · Fixed by #7079
Labels
topic: focus topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@emilio
Copy link
Contributor

emilio commented Sep 14, 2021

Calling blur() on a shadow host with delegatesFocus = true should blur content inside the shadow tree. This matches sanity (blur() should undo what focus() does) and both WebKit and Blink.

However per spec this shouldn't happen. blur() executes https://html.spec.whatwg.org/#unfocusing-steps, but if you call that on a shadow host with delegatesFocus you bail out here:

If old focus target is not one of the entries in old chain, then return.

Unless I'm missing something, since neither https://html.spec.whatwg.org/#current-focus-chain-of-a-top-level-browsing-context or https://html.spec.whatwg.org/#focus-chain deal with delegatesFocus in any way (and I don't think they should, probably).

See https://bugzilla.mozilla.org/show_bug.cgi?id=1730566 for a test-case.

@domenic
Copy link
Member

domenic commented Sep 14, 2021

Makes sense. Are you able to figure out a rough spec patch that would fix this? Either as a PR, or just writing it up informally here and I can translate it, would be great.

@domenic domenic added topic: focus topic: shadow Relates to shadow trees (as defined in DOM) labels Sep 14, 2021
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 15, 2021
@emilio
Copy link
Contributor Author

emilio commented Sep 15, 2021

@domenic I think around step 2 we should say something like "if old focus target is a shadow host, and its shadow root delegates focus, and the currently focused area of a top-level browsing context is a shadow-including descendant of the shadow root, then let old focus target be the currently focused area of a top-level browsing context."

Or something like that.

@domenic
Copy link
Member

domenic commented Sep 16, 2021

Sounds good. My tentative guess it it should be the very first step, right? Since we probably want to do inert checking/area stuff on the "computed" old focus target, not the original.

I'll send a PR shortly.

domenic added a commit that referenced this issue Sep 16, 2021
@domenic domenic mentioned this issue Sep 16, 2021
3 tasks
aosmond pushed a commit to aosmond/gecko that referenced this issue Sep 18, 2021
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 20, 2021
This intends to address: whatwg/html#7070

Differential Revision: https://phabricator.services.mozilla.com/D125477

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1730566
gecko-commit: 8fb7f5a7c65404c7d157e61f29b093c5a50f343d
gecko-reviewers: emilio
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 20, 2021
This intends to address: whatwg/html#7070

Differential Revision: https://phabricator.services.mozilla.com/D125477

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1730566
gecko-commit: 8fb7f5a7c65404c7d157e61f29b093c5a50f343d
gecko-reviewers: emilio
domenic added a commit that referenced this issue Oct 28, 2021
* Make it use the shadow tree instead of the flat tree. Closes #7207.
* Make it work with the unfocusing steps symmetrically to the focusing steps. Closes #7070.
domenic added a commit that referenced this issue Nov 1, 2021
* Make it use the shadow tree instead of the flat tree. Closes #7207.
* Make it work with the unfocusing steps symmetrically to the focusing steps. Closes #7070.
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this issue Nov 18, 2021
This intends to address: whatwg/html#7070

Differential Revision: https://phabricator.services.mozilla.com/D125477

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1730566
gecko-commit: 8fb7f5a7c65404c7d157e61f29b093c5a50f343d
gecko-reviewers: emilio
dandclark pushed a commit to dandclark/html that referenced this issue Dec 4, 2021
* Make it use the shadow tree instead of the flat tree. Closes whatwg#7207.
* Make it work with the unfocusing steps symmetrically to the focusing steps. Closes whatwg#7070.
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
* Make it use the shadow tree instead of the flat tree. Closes whatwg#7207.
* Make it work with the unfocusing steps symmetrically to the focusing steps. Closes whatwg#7070.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: focus topic: shadow Relates to shadow trees (as defined in DOM)
Development

Successfully merging a pull request may close this issue.

2 participants