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

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

Merged
merged 12 commits into from
Feb 1, 2024

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Jan 9, 2024

📝 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.

Before After
image image

🚧 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
image image image

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
image image image
image image image

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
image image image

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
image image image

fix(table): replace InlineActionsContainer by NcActionButtonGroup

It has the same styles and correct a11y attributes.

👀 Place 🏚️ Before 🏡 After
image image image

fix(table): make text align buttons radio

🏚️ Before 🏡 After
image image
image image

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
image image image

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/[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 without active state like Undo

This doesn't fully work without the next one commit

👀 Place 🏚️ Before 🏡 After
image image image
image image image

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
image image
image image
image image

fix(menubar): add separator between radio groups

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

fix(menubar): name ActionFormattingHelp as NcActionButton

Same as with separating NcActionButton - for NcActions support

👀 Place 🏚️ Before 🏡 After
image image image

🏁 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

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

This comment was marked as resolved.

@JuliaKirschenheuter JuliaKirschenheuter self-assigned this Jan 10, 2024
@ShGKme ShGKme force-pushed the fix/5216/remove-incorrect-roles branch 2 times, most recently from f4d2a4d to ad73420 Compare January 10, 2024 13:32
@ShGKme

This comment was marked as resolved.

@JuliaKirschenheuter JuliaKirschenheuter removed their assignment Jan 10, 2024
@ShGKme ShGKme force-pushed the fix/5216/remove-incorrect-roles branch 6 times, most recently from 7cb42b4 to 007d27d Compare January 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 <[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]>
@ShGKme ShGKme force-pushed the fix/5216/remove-incorrect-roles branch from 007d27d to 4ccb4bf Compare January 31, 2024 10:57
@ShGKme ShGKme changed the title fix: remove incorrect role attrs from menu bar actions fix(menubar): menubar and table menus a11y Jan 31, 2024
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]>
- 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]>
@ShGKme ShGKme force-pushed the fix/5216/remove-incorrect-roles branch from 4ccb4bf to 9be897e Compare January 31, 2024 11:16
Copy link
Collaborator

@max-nextcloud max-nextcloud left a 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.

src/components/Menu/MenuBar.vue Outdated Show resolved Hide resolved
Copy link
Collaborator

@max-nextcloud max-nextcloud left a 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. 🪄

Copy link

@emoral435 emoral435 left a 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 :)

Copy link
Contributor

@JuliaKirschenheuter JuliaKirschenheuter left a comment

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
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
Contributor Author

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
Copy link
Contributor Author

ShGKme commented Feb 1, 2024

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 <[email protected]>
- Separates different parts visually
- Required for a11y to group radio button in the menu

Signed-off-by: Grigorii K. Shartsev <[email protected]>
@ShGKme
Copy link
Contributor Author

ShGKme commented Feb 1, 2024

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

@ShGKme ShGKme force-pushed the fix/5216/remove-incorrect-roles branch from 11bba34 to 9d31390 Compare February 1, 2024 11:16
@ShGKme ShGKme enabled auto-merge February 1, 2024 11:20
@juliusknorr
Copy link
Member

/backport to stable28

@ShGKme ShGKme merged commit 11a3295 into main Feb 1, 2024
53 checks passed
@ShGKme ShGKme deleted the fix/5216/remove-incorrect-roles branch February 1, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants