Skip to content

feat: accessibility improvements #718

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

Merged
merged 56 commits into from
May 5, 2024
Merged

Conversation

YousefED
Copy link
Collaborator

@YousefED YousefED commented May 2, 2024

After a consultation with accessibility experts, this PR implements some important improvements in terms of accessibility:

  • Better keyboard navigation:
    -- the editor can be exited with "esc"
    -- menus (formatting toolbar, link menu, image panel) can be tabbed into with "tab", exited with "esc"
  • the suggestion menu is now a combobox / listbox aria element of the editor. The active item is marked using virtual focus (activedescendent), which should bring better support for screenreaders. (we need to test this a bit more extensively)
  • All buttons have the right aria-label attributes, toggle buttons have aria-pressed

As part of this PR, we also:

  • moved responsibility of closing menus from the plugins to Floating-UI, with the useDismiss hook
  • cleaned up some CSS
  • added stronger typescript support which enforces all props to be used (or at least destructured) when implementing a UI layer. This makes sure we get compile errors when new props are being added, but not implemented by all UI layers

This should be a significant improvement in terms of accessibility! However, we should also recognize this is a subject that's never "done" and continuously improve here. Next steps could include:

  • Extensive manual testing using screen readers and / or a test group
  • Automated testing, ideally integrated into CI workflow
  • Implement keyboard navigation for drag handle (side) menu
  • Add a "hint sheet" that shows keyboard shortcuts / accessibility tips to end users
  • Validate / improve color contrasts
  • Improve accessibility / keyboard nav for lists, tables, and images

matthewlipski and others added 30 commits March 6, 2024 20:02
* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components
* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components

* refactor: Extract Mantine & Ariakit packages (#689)

* Extracted mantine & ariakit packages

* fix: ShadCN color styles button & form components (#696)

* Added ShadCN color styles button & form components

* refactor: UI libs CSS+API refactor (#698)

* Cleaned up component context API

* WIP

* Refactored CSS & ShadCN API

* Fixed Ariakit component props

* Fixed Mantine component props

* Fixed ShadCN component props

* Cleanup

* Misc fixes

* - Added remaining components to context
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build

* Changed ShadCN suggestion menu to use Card

* Small fix

* Fixed linting

* Fixed `BlockNoteViewRaw` typing

* Misc fixes

* Misc fixes

* Fixed unit tests

* Fixed Mantine sub menus

* Misc UI fixes

* Misc changes

* fix import

* fix tablehandles performance issue / max call stack

* Fixed PW tests

* Small fix

* Added ShadCN/Ariakit tests

* fix draghandles

* add vercel rewrites

* improve shadcn setup

* Fixed remaining Ariakit/ShadCN/Mantine styles

* extract strings from react package

* extract all strings

* clean i18n setup

* fix build

* Fixed dark mode for Ariakit/ShadCN

* Misc fixes

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>
Copy link
Collaborator

@matthewlipski matthewlipski left a comment

Choose a reason for hiding this comment

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

Looks good! While doing some manual testing I found a few behaviours that are still not quite there:

  • Formatting toolbar loses tab index after pressing enter (maybe intentional?)
  • Pressing escape in link creation & caption menus closes whole formatting toolbar instead of just those menus
  • Pressing enter on colors drag handle menu button closes menu (mantine)
  • Tabbing order in image toolbar not working (mantine, though it has some quirks in the others too)
  • Tooltips don’t show up when hovering using keyboard (mantine)
  • Formatting toolbar tabbing not working (ariakit)


const handleMouseLeave = useCallback(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How come we don't need this anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've disabled this because I figured copying the ariakit combobox behavior (separate focus and hover states) would be fine.

But then I noticed for menus they don't have this behavior, so I started a conversation with the ariakit maintainer:

image

Perhaps bringing it back is a good idea, but let's do this as a separate PR or if more people experience this as an issue, as we're a bit limited on time atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants