Skip to content

fix(menubar): menubar and table menus a11y - #5218

Merged
ShGKme merged 12 commits into
mainfrom
fix/5216/remove-incorrect-roles
Feb 1, 2024
Merged

fix(menubar): menubar and table menus a11y#5218
ShGKme merged 12 commits into
mainfrom
fix/5216/remove-incorrect-roles

Conversation

@ShGKme

@ShGKmeShGKme commented Jan 9, 2024

Copy link
Copy Markdown
Contributor

📝 Summary

Currently aria-* and role attrs in the MenuBar are set incorrectly. These attributes are already covered by @nextcloud/vue. This PR removes setting attributes from the Text and adjust using NcAction* components.

There are quite a lot of changes. Separated with 💙 into small commits.

BeforeAfter
imageimage

🚧 TODO

fix: apply a11y attrs for session list trigger

  • Migrate from deprecated slot syntax
  • Use a11y attrs from NcPopover on a custom button

image

No visual changes

👀 Place🏚️ Before🏡 After
imageimageimage

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.

👀 Place🏚️ Before🏡 After
imageimageimage
imageimageimage

fix(menubar): remove incorrect aria-haspopup

  • It must have string "true"/"menu" value
  • It must be placed on the button itself
  • It is already correctly set by NcActions and NcPopover
👀 Place🏚️ Before🏡 After
imageimageimage

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
👀 Place🏚️ Before🏡 After
imageimageimage

fix(table): replace InlineActionsContainer by NcActionButtonGroup

It has the same styles and correct a11y attributes.

👀 Place🏚️ Before🏡 After
imageimageimage

fix(table): make text align buttons radio

🏚️ Before🏡 After
imageimage
imageimage

fix(menubar): replace aria-pressed with text description in ActionList

  • aria-pressed is not valid for a menu trigger button. And
  • As an alternative solution - show that there is a selected value directly in the text
    • Headings, "Heading 1" is selected
  • Remove incorrect name prop for NcActions
👀 Place🏚️ Before🏡 After
imageimageimage

refactor: implement ActionSingle via template instead of render-function

Just to simplify further work and Vue 3 migration next release

No visual changes

fix(menubar): set correct type for buttons instead of aria-selected

  • Since @nextcloud/vue@8.6.0 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 without active state like Undo

This doesn't fully work without the next one commit

👀 Place🏚️ Before🏡 After
imageimageimage
imageimageimage

fix(menubar): separate NcActionButton from ActionSingle

  • 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
🏚️ Before🏡 After
imageimage
imageimage
imageimage

fix(menubar): add separator between radio groups

  • Separates different parts visually
  • Required for a11y to group radio button in the menu
🏚️ Before🏡 After
imageimage
imageimage

fix(menubar): name ActionFormattingHelp as NcActionButton

Same as with separating NcActionButton - for NcActions support

👀 Place🏚️ Before🏡 After
imageimageimage

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@ShGKmeShGKme added bug Something isn't working 2. developing accessibility labels Jan 9, 2024
@ShGKmeShGKme added this to the Nextcloud 29 milestone Jan 9, 2024
@ShGKmeShGKme self-assigned this Jan 9, 2024
@ShGKmeShGKme linked an issue Jan 9, 2024 that may be closed by this pull request
4 tasks
@JuliaKirschenheuter

This comment was marked as resolved.

@ShGKme
ShGKmeforce-pushed the fix/5216/remove-incorrect-roles branch 2 times, most recently from f4d2a4d to ad73420CompareJanuary 10, 2024 13:32
@ShGKme

This comment was marked as resolved.

@JuliaKirschenheuterJuliaKirschenheuter removed their assignment Jan 10, 2024
@ShGKme
ShGKmeforce-pushed the fix/5216/remove-incorrect-roles branch 6 times, most recently from 7cb42b4 to 007d27dCompareJanuary 31, 2024 10:51
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 <me@shgk.me>
- 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 <me@shgk.me>
- `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 <me@shgk.me>
It has the same styles and correct a11y attributes.
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
@ShGKme
ShGKmeforce-pushed the fix/5216/remove-incorrect-roles branch from 007d27d to 4ccb4bfCompareJanuary 31, 2024 10:57
@ShGKmeShGKme changed the title fix: remove incorrect role attrs from menu bar actionsfix(menubar): menubar and table menus a11yJan 31, 2024
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
- `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 <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
- Since `@nextcloud/vue@8.6.0` 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 <me@shgk.me>
@ShGKme
ShGKmeforce-pushed the fix/5216/remove-incorrect-roles branch from 4ccb4bf to 9be897eCompareJanuary 31, 2024 11:16

@max-nextcloudmax-nextcloud left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment threadsrc/components/Menu/MenuBar.vue

@max-nextcloudmax-nextcloud left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Works like a charm. 🪄

@emoral435emoral435 left a comment

Copy link
Copy Markdown

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 :)

@JuliaKirschenheuterJuliaKirschenheuter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wooow! That looks great and works right!

All good from my side besides:

image

But this is NcVue part

Comment on lines +31 to +35
<div class="avatardiv icon-group" />
<AvatarWrapper v-for="session in sessionsVisible"
:key="session.id"
:session="session"
:size="40" />

Copy link
Copy Markdown
Member

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!

Copy link
Copy Markdown
ContributorAuthor

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.

@ShGKme

ShGKme commented Feb 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Two fixup!s:

  1. Fix potential issue @max-nextcloud found (reviewed)
  2. To make NcActions' children named NcActionButton is was enough to change name property, without having to change the filename.

One new change:

  1. Fix 1/2 issues @JuliaKirschenheuter has found (the second one is on @nextcloud/vue and is less critical)

- 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 <me@shgk.me>
- Separates different parts visually
- Required for a11y to group radio button in the menu
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
…NcActions
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
@ShGKme

Copy link
Copy Markdown
ContributorAuthor

Rebased onto master, squashed fixup commits (only small changes like renaming components were made, still works).

@ShGKme
ShGKmeforce-pushed the fix/5216/remove-incorrect-roles branch from 11bba34 to 9d31390CompareFebruary 1, 2024 11:16
@ShGKme
ShGKme enabled auto-merge February 1, 2024 11:20
@juliusknorr

Copy link
Copy Markdown
Member

/backport to stable28

@ShGKme
ShGKme merged commit 11a3295 into mainFeb 1, 2024
@ShGKme
ShGKme deleted the fix/5216/remove-incorrect-roles branch February 1, 2024 11:30
@blizzzblizzz mentioned this pull request Mar 5, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewaccessibilitybugSomething isn't working

Projects

None yet

6 participants

@ShGKme@JuliaKirschenheuter@juliusknorr@Pytal@max-nextcloud@emoral435