-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat(NcPopover): provide a11y attributes to the trigger #5086
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ShGKme
added
enhancement
New feature or request
2. developing
Work in progress
feature: popover
Related to the popovermenu component
accessibility
Making sure we design for the widest range of people possible, including those who have disabilities
labels
Jan 17, 2024
ShGKme
changed the title
Fix/nc popover trigger attrs
feat(NcPopover): provide a11y attributes to the trigger
Jan 17, 2024
ShGKme
added
feature: datepicker
Related to the date/time picker component
feature: actions
Related to the actions components
feature: colorpicker
Related to the colorpicker component
feature: userbubble
Related to the userbubble component
feature: emoji picker
Related to the emoji picker component
labels
Jan 17, 2024
ShGKme
force-pushed
the
fix/nc-popover-trigger-attrs
branch
4 times, most recently
from
January 17, 2024 23:57
36dc429
to
5606dae
Compare
ShGKme
requested review from
susnux,
Pytal,
raimund-schluessler,
JuliaKirschenheuter and
skjnldsv
and removed request for
susnux and
Pytal
January 17, 2024 23:57
ShGKme
force-pushed
the
fix/nc-popover-trigger-attrs
branch
from
January 18, 2024 00:05
5606dae
to
7cf1c44
Compare
ShGKme
added
3. to review
Waiting for reviews
and removed
2. developing
Work in progress
labels
Jan 18, 2024
I'll add tests later when most of a11y issues are fixed 👉👈 |
ShGKme
force-pushed
the
fix/nc-popover-trigger-attrs
branch
from
January 18, 2024 00:08
7cf1c44
to
b03dd57
Compare
JuliaKirschenheuter
approved these changes
Jan 18, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR which resolves so many places! 🥳🥳 Works!
Thanks a lot!
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
ShGKme
force-pushed
the
fix/nc-popover-trigger-attrs
branch
from
January 18, 2024 16:12
b03dd57
to
32af0a7
Compare
susnux
approved these changes
Jan 18, 2024
computed: { | ||
shownProxy: { | ||
get() { | ||
return this.shown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3. to review
Waiting for reviews
accessibility
Making sure we design for the widest range of people possible, including those who have disabilities
enhancement
New feature or request
feature: actions
Related to the actions components
feature: colorpicker
Related to the colorpicker component
feature: datepicker
Related to the date/time picker component
feature: emoji picker
Related to the emoji picker component
feature: popover
Related to the popovermenu component
feature: userbubble
Related to the userbubble component
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
☑️ Resolves
NcPopover
usages exceptNcActions
...A problem
NcPopover
trigger button should have a11y attributesaria-haspopup="<role>"
aria-expanded="<is shown>"
NcPopover
is used to make sure its trigger button has attributes.This implementation might look a bit complex, but it helps to make a lot of popovers more accessible.
1. Provide
NcPopover:trigger:attrs
fromNcPopover
to its#trigger
slot's contentSo any component used as a trigger may receive the attrs, required to be on the trigger
A small component
NcPopoverTriggerProvider
is created to provide content only to the trigger, not to the content.2. Inject it in
NcButton
NcButton
is the most popularNcPopover
trigger.This may look incorrect that
NcButton
"knows" something about the popover. But as it is a part of one library, and they are used together very often, it is a plain solution to cover a lot of cases. Without requirements to change anything in the apps.Covers:
NcColorPicker
,NcEmojiPicker
,NcActions
NcPopover
usages withNcButton
trigger in all Nextcloud apps3. Provide the attributes as slot props
To manually set them in other cases
NcDatetimePicker
,NcUserBubble
And the same in
NcColorPicker
4. Add
role
prop to specify the role of the popoverSee: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup
🖼️ Screenshots
What still have to be done manually in place
NcButton
:v-slot="{ attrs }" + v-bind="attrs"
NcPopover
content:popupRole
on<NcPopover>
role
on the contentaria-label
oraria-labelledby
for dialog contentThis is where a warning in the
debug
mode helps to find the issue:Alternative solution
Using DOM API by
querySelector
find anybutton
in the#trigger
slot and mutate it.🏁 Checklist