Skip to content

Autofocus fix #51

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

Merged
merged 4 commits into from
Jul 21, 2021
Merged

Autofocus fix #51

merged 4 commits into from
Jul 21, 2021

Conversation

pablonete
Copy link
Contributor

@pablonete pablonete commented Jul 20, 2021

If the dropdown itself is the autofocus field in the page, then <details-menu> fails to set focus to any other autofocus element in the popup when displaying it.
Reason being that the selector matches first the <summary> and wrongly sets focus to it instead of any autofocus element inside the details-menu.
An example was added to demonstrate the issue. It fails currently using the @latest version, but it's fixed when using dist.

  • Write a test that covers this case.

If the dropdown itself is the `autofocus` field in the page, then `<details-menu>` fails to set focus to any other `autofocus` element in the popup when displaying it.
Reason being that the selector matches first the `<summary>` and wrongly sets focus to it instead.
@pablonete pablonete requested a review from koddsson July 20, 2021 15:56
@pablonete pablonete requested a review from a team as a code owner July 20, 2021 15:56
@pablonete pablonete requested a review from bscofield July 20, 2021 15:56
Copy link
Contributor

@manuelpuyol manuelpuyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm, but would love to see a test :)

Copy link

@darthwillis darthwillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good change to me. A test would be great to ensure it doesn't regress.

Copy link
Contributor

@koddsson koddsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me once we add a test ✨

pablonete and others added 2 commits July 21, 2021 11:36
Co-authored-by: Kristján Oddsson <koddsson@github.com>
@koddsson koddsson merged commit 202237d into github:main Jul 21, 2021
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 this pull request may close these issues.

4 participants