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

Close menu when focus leaves #1367

Merged
merged 1 commit into from
Nov 16, 2022
Merged

Conversation

Pytal
Copy link
Member

@Pytal Pytal commented Nov 15, 2022

  • FIXME Focus on open doesn't work

When programmatically setting focus on an element i.e. element.focus() only :focus styles are applied but not :focus-visible and the API which supports this is still experimental (see references below)

So we add the style declaration https://github.com/nextcloud/nextcloud-vue/blob/10fbb7829803731a26ebae2f0ce0be40d26901a1/src/components/NcButton/NcButton.vue#L501 to the :focus pseudo-class to resolve this

References

Signed-off-by: Christopher Ng <[email protected]>
@Pytal Pytal force-pushed the enh/a11y-close-on-focusout branch from 6ecfbce to f6db640 Compare November 16, 2022 03:18
@Pytal Pytal marked this pull request as ready for review November 16, 2022 03:28
@Pytal Pytal requested a review from nickvergessen as a code owner November 16, 2022 03:28
@Pytal Pytal requested review from JuliaKirschenheuter, mejo- and nickvergessen and removed request for nickvergessen November 16, 2022 03:28
@Pytal
Copy link
Member Author

Pytal commented Nov 16, 2022

/backport to stable25

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Feels weird to have to do this manually 😬

Comment on lines +492 to +496
:deep(.button-vue) {
&:focus {
outline: 2px solid var(--color-main-text) !important;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Worth raising an upstream issue in the vue library? That should basically affect every place this is done?

Copy link
Member Author

Choose a reason for hiding this comment

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

Based on https://github.com/nextcloud/nextcloud-vue/blob/ade7ba30f759700b3a0b28dca227009ef8157153/src/components/NcButton/NcButton.vue#L426-L429 would say this should only be done in specific cases like these where it is necessary

@nickvergessen nickvergessen merged commit e515cfd into master Nov 16, 2022
@nickvergessen nickvergessen deleted the enh/a11y-close-on-focusout branch November 16, 2022 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants