-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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 focus handling for plugin and prompt dialogs #10801
Desktop: Accessibility: Improve focus handling for plugin and prompt dialogs #10801
Conversation
…ould have been out of the scope of this PR)
background-color: rgba(0,0,0,0.6); | ||
background-color: rgba(0,0,0,0.5); |
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.
This CSS change prevents this pull request from changing the backdrop color for plugin dialogs.
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied | ||
public onKeyDown(event: any) { | ||
if (event.keyCode === 27) { // ESCAPE | ||
this.props.dispatch({ | ||
pluginName: PLUGIN_NAME, | ||
type: 'PLUGINLEGACY_DIALOG_SET', | ||
open: false, | ||
}); | ||
} | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied | ||
private modalLayer_onClick(event: any) { | ||
if (event.currentTarget === event.target) { | ||
this.props.dispatch({ | ||
pluginName: PLUGIN_NAME, | ||
type: 'PLUGINLEGACY_DIALOG_SET', | ||
open: false, | ||
}); | ||
} | ||
} | ||
private modalLayer_onDismiss = () => { |
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.
Dismissing the dialog with escape or clicking outside of the dialog is now handled by Dialog.tsx
. As such, this logic has been removed from GotoAnything.tsx
.
That looks good, thanks for implementing this! The difference before/after looks good to me. Rounded corners on dialogs are fine I guess. |
Summary
This pull request improves focus handling for additional dialog types in a way similar to #10779. Specifically, for
This is done by migrating these dialogs to the
gui/Dialog
component. Since #10779,Dialog
prevents items behind the dialog modal container from having keyboard focus.Why?
This change brings Joplin closer to compliance with WCAG 2.2 (issue #10795).
From the WCAG 2.2's "Understanding SC 2.4.11: Focus Not Obscured (Minimum) (Level AA)",
Before this pull request, it was possible for focus to be hidden by plugin, prompt, statistics, and the go-to-anything dialogs. This pull request uses a modal
<dialog>
element to prevent keyboard focus from escaping, and thus potentially being hidden by, visible dialogs.Stylistic changes
Switching to the
Dialog
component also changes the CSS used to style the dialog container. These changes are shown below.Prompt dialog/text: Rounded corners and slightly more padding above:
Prompt dialog/date time: Rounded corners, the date time input now has focus by default. This currently causes the calendar to be visible by default. Previously, keyboard focus remained on the control that opened the dialog.
Plugin dialogs/one dialog open: When just one dialog is open, styles should be roughly the same:
Plugin dialogs/multiple dialogs open: When multiple dialogs are opened, the last-opened dialog now needs to be dismissed before the other dialog(s) can be used:
Go-to-anything dialog: Rounded corners:
Testing
This pull request includes automated tests for the following:
Dialog.tsx
(rather than inGotoAnything.tsx
). As such, this also tests the relevant logic inDialog.tsx
.Dialog.tsx
.:setTags
from "Go to anything".The following manual testing has also been done on Ubuntu 24.04:
joplin-plugin-content
using the developer tools (set to 500px).:insertDrawing
(from the Freehand Drawing plugin)