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

[delegatesFocus] Focus should transfer to focusable ancestor (in the same shadow) when click target is not focusable #1382

Closed
ekashida opened this issue Jun 28, 2019 · 0 comments · Fixed by #1383

Comments

@ekashida
Copy link
Member

Description

When the user clicks on a focusable element, the delegatesFocus polyfill disables all the magic and lets the browser do its thing. This implementation breaks down when the click target is a non-focusable element wrapped by a focusable element.

Expected Behavior

Focus should apply to the focusable element wrapping the non-focusable element when the non-focusable element is clicked.

Observed Behavior

Clicks on non-focusable elements causes focus to be forwarded to the next focusable element outside of the shadow, even the the click target is wrapped by a focusable element (such as a button).

It is as though the user arrived at the target via sequential focus navigation, sees that the shadow host has a tabindex value of -1, and forwards focus to the next focusable element outside of the shadow.

Steps to Reproduce

https://playground.lwcjs.org/projects/CsB3R9LDu/6/edit

ekashida added a commit that referenced this issue Jun 28, 2019
#1383)

* test: reproduce bug described by issue #1382

* fix: consider ancestors when determining focusability
ekashida added a commit that referenced this issue Jun 28, 2019
* test: reproduce bug described by issue #1382

* fix: consider ancestors when determining focusability
ekashida added a commit that referenced this issue Jun 28, 2019
#1384)

* fix(synthetic): consider ancestors when determining click-focusability

* test: reproduce bug described by issue #1382

* fix: consider ancestors when determining focusability

* chore: simulate old behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant