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

Desktop: Accessibility: Improve "change application layout" screen keyboard accessibility #11718

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Jan 23, 2025

Summary

This pull request improves the accessibility of the "change application layout" screen. In particular, it,

  1. Keyboard: Prevents keyboard focus from being on the content behind the "change application layout" screen. (See SC 2.4.3: Focus order).
    • Previously, it was difficult to move keyboard focus to the move buttons in the "change application layout" screen. Focus would instead remain in the content behind the screen.
    • This is fixed by displaying the move/resize controls (when open) in a <dialog>, which causes Electron to prevent keyboard focus from interacting with content behind the "change application layout" screen while open.
  2. Labels: Adds labels to the "move" buttons. (See SC 1.1.1: Non-text content).
    • Buttons now describe the move action (e.g. "move left") and are in a group labelled with what they move (e.g. "editor").
  3. Labels: Marks the "use arrows to move..." header as a header. (See SC 4.1.2: Name, role, value).

Note: This pull request refactors parts of ResizableLayout to improve type safety.

Related to #10795.

To-do

For this pull request:

For a follow-up pull request:

  • Bug: On very small screens, the header can overlap with the "move layout item" buttons.
    • Not a regression, this can be done in a separate PR.
  • Screen reader: After clicking a button, no information about the new screen layout is given.

Testing plan

This pull request adds automated end-to-end tests that verify: 1) the change layout screen opens and passes the automated accessibility scanner and 2) clicking "move right" for the sidebar keeps the "move right" button focused.

Manual testing (Fedora 41):

  1. Enable the screen reader (Orca).
  2. Start Joplin.
  3. Activate "Change application layout" from the "View" menu.
  4. Verify that Joplin, after reading the window title, reads Use the arrows to move the layout items. Press "Escape" to exit. then Sidebar panel, Move right button.
  5. Activate "Reset application layout" from the "View" menu.
  6. Click "OK".
  7. Press tab.
  8. Verify that Orca reads Note list panel, move left button.
  9. Press enter.
  10. Verify that the panel is moved left.
    • Note: The change in layout is currently not announced. See the to-do section.
  11. Verify that the "move left" button still has focus.
  12. Press enter.
  13. Verify that the note list panel is now on the far left side of the screen.
  14. Verify that the "move right" button now has focus.
  15. Press escape.
  16. Verify that the "change application layout" dialog is no longer visible.
  17. Using the mouse, increase the size of the note list panel.
  18. Verify that the note list panel size is larger.
  19. Using the "View" menu, reset the application layout.
  20. Verify that the layout has been reset.

@personalizedrefrigerator personalizedrefrigerator marked this pull request as ready for review January 24, 2025 19:25
@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Accessibility: Improve "change application layout" screen accessibility Desktop: Accessibility: Improve "change application layout" screen keyboard accessibility Jan 24, 2025
Comment on lines +21 to +22
type ReactButtonProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
interface Props extends Omit<ReactButtonProps, 'onClick'> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Most of the changes to the Button component are to pass unused props through to the <button> component it wraps. This removes the need to enumerate all aria-* props that can be used with custom <Button>s.


const viewInfo = pluginUtils.viewInfoByViewId(plugins, key);
if (viewInfo) {
return PluginService.instance().safePluginNameById(viewInfo.plugin.id);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
return PluginService.instance().safePluginNameById(viewInfo.plugin.id);
return PluginService.instance().pluginNameById(viewInfo.plugin.id);

The above is currently used to label panels from plugins. The "safe" in "safePluginNameById" was intended to mean that the method doesn't throw if the plugin isn't installed/loaded. However, just pluginNameById may make more sense.

Comment on lines 34 to +44
&.-fullscreen {
max-width: 100vw;
max-height: 100vh;

&::backdrop {
background-color: var(--joplin-background-color);
}

> .content {
width: calc(100% - 20px);
padding: 10px;
margin: 0;
padding: 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These changes allow the "change application layout" screen to completely overlay the main app content. At present,

  • The application panels are shown behind the application layout <dialog>. The modal <dialog> prevents these panels from receiving keyboard focus while changing the application layout.
  • The layout <dialog> contains the movement controls and a resizable region for each panel.

@personalizedrefrigerator personalizedrefrigerator merged commit 762daa5 into laurent22:dev Jan 27, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Related to accessibility desktop All desktop platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants