-
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
fix(menubar): menubar and table menus a11y #5218
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
f4d2a4d
to
ad73420
Compare
This comment was marked as resolved.
This comment was marked as resolved.
7cb42b4
to
007d27d
Compare
All these roles are correctly set by `NcAction*` components when needed. Setting these roles in mixins and menu bar puts them on wrong elements. Signed-off-by: Grigorii K. Shartsev <[email protected]>
- It must have string `"true"/"menu"` value - It must be placed on the `button` itself - It is already correctly set by `NcActions` and `NcPopover` Signed-off-by: Grigorii K. Shartsev <[email protected]>
- `aria-activedescendant` should identify a visually focused element when the real focus remains on this element. In the current implementation it identified selected element (even when the menu is closed), not the focused. - `aria-activedescendant` is not needed because NcAction has actual focus anyway. In case it will be actually needed, it should be implemented in the `NcActions` Signed-off-by: Grigorii K. Shartsev <[email protected]>
It has the same styles and correct a11y attributes. Signed-off-by: Grigorii K. Shartsev <[email protected]>
007d27d
to
4ccb4bf
Compare
Signed-off-by: Grigorii K. Shartsev <[email protected]>
- `aria-pressed` is not valid for a menu trigger button - As alternative solution - show that there is a selected value directly in the text - Remove incorrect prop for NcActions Signed-off-by: Grigorii K. Shartsev <[email protected]>
Signed-off-by: Grigorii K. Shartsev <[email protected]>
- Since `@nextcloud/[email protected]` correct attributes are covered by `NcAction*` and `NcButton` components, including fixes: - Attribute should display not only active `attr="true"` state, but also non-active `attr="false"` - It should be `aria-pressed` for buttons and `aria-checked` for menu items instead of `aria-selected` - Set correct `type` and active state - `type="radio"` for a list of options like `Heading` - `type="checkbox"` for toggle buttons like `Bold` - `type="button"` for general buttons widhout active state like `Undo` Signed-off-by: Grigorii K. Shartsev <[email protected]>
4ccb4bf
to
9be897e
Compare
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.
Thanks a lot for splitting up the individual aspects. This was very helpful for understanding.
I only looked at the code so far. I'd like to play a bit with it before approving. I also have one minor comment I want to look into further.
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.
Works like a charm. 🪄
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.
The splitting of the issues within the description was really nice! No comments from me, just always great to learn how I should structure future problems with your best practices :)
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.
<div class="avatardiv icon-group" /> | ||
<AvatarWrapper v-for="session in sessionsVisible" | ||
:key="session.id" | ||
:session="session" | ||
:size="40" /> |
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.
The div here should be switched to span and the divs inside AvatarWrapper also need to be span to not have block-level elements inside the inline button
Otherwise good!
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.
Thanks. I'll do it in another PR with fixing HTML validation issues.
Two
One new change:
|
- ActionSingle was used in 2 places: 1. As a single button in the menu 2. As an item in NcActions - NcActions doesn't fully support non-direct NcAction* children - Move NcActionButton usage from ActionSingle to a new component - This new component is named NcActionButton so that NcActions will consider it to be a valid NcAction* component Signed-off-by: Grigorii K. Shartsev <[email protected]>
- Separates different parts visually - Required for a11y to group radio button in the menu Signed-off-by: Grigorii K. Shartsev <[email protected]>
…NcActions Signed-off-by: Grigorii K. Shartsev <[email protected]>
Rebased onto master, squashed fixup commits (only small changes like renaming components were made, still works). |
11bba34
to
9d31390
Compare
/backport to stable28 |
📝 Summary
menuitem
andmenu
#5216Currently
aria-*
androle
attrs in theMenuBar
are set incorrectly. These attributes are already covered by@nextcloud/vue
. This PR removes setting attributes from the Text and adjust usingNcAction*
components.There are quite a lot of changes. Separated with 💙 into small commits.
🚧 TODO
fix: apply a11y attrs for session list trigger
NcPopover
on a custom buttonNo visual changes
fix(menubar): remove unneeded roles
menu
,menuitem
All these roles are correctly set by
NcAction*
components when needed.Setting these roles in mixins and menu bar puts them on wrong elements.
fix(menubar): remove incorrect
aria-haspopup
"true"/"menu"
valuebutton
itselfNcActions
andNcPopover
fix(menubar): remove incorrect
aria-activedescendant
aria-activedescendant
should identify a visually focused element when the real focus remains on this element.In the current implementation, it identifies the checked element (even when the menu is closed), not the focused.
aria-activedescendant
is not needed because NcAction has actual focus anyway.In case it will be actually needed, it should be implemented in the
NcActions
fix(table): replace
InlineActionsContainer
byNcActionButtonGroup
It has the same styles and correct a11y attributes.
fix(table): make text align buttons radio
fix(menubar): replace
aria-pressed
with text description inActionList
aria-pressed
is not valid for a menu trigger button. AndHeadings, "Heading 1" is selected
name
prop forNcActions
refactor: implement
ActionSingle
via template instead of render-functionJust to simplify further work and Vue 3 migration next release
No visual changes
fix(menubar): set correct type for buttons instead of
aria-selected
@nextcloud/[email protected]
correct attributes are covered byNcAction*
andNcButton
components, including fixes:attr="true"
state, but also non-activeattr="false"
aria-pressed
for buttons andaria-checked
for menu items instead ofaria-selected
type
and active statetype="radio"
for a list of options likeHeading
type="checkbox"
for toggle buttons likeBold
type="button"
for general buttons without active state likeUndo
This doesn't fully work without the next one commit
fix(menubar): separate
NcActionButton
fromActionSingle
ActionSingle
was used in 2 places:NcActions
NcActions
doesn't fully support non-directNcAction*
childrenNcActionButton
usage fromActionSingle
to a new componentNcActionButton
so thatNcActions
will consider it to be a validNcAction*
componentfix(menubar): add separator between radio groups
fix(menubar): name
ActionFormattingHelp
asNcActionButton
Same as with separating
NcActionButton
- forNcActions
support🏁 Checklist
npm run lint
/npm run stylelint
/composer run cs:check
)