-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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: Fixes focus going to start of document when Note History is open #11769
Conversation
@@ -92,6 +93,7 @@ const NoteRevisionViewerComponent: React.FC<Props> = ({ themeId, noteId, onBack, | |||
|
|||
setRevisions(revisions); | |||
setCurrentRevId(revisions.length ? revisions[revisions.length - 1].id : ''); | |||
focus('NoteRevisionViewer::viewer_domReady', viewerRef.current); |
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.
Thank you for working on this! To prevent the autofocus from being removed in the future, consider adding a comment explaining why this autofocus is necessary.
(Optional): It may make more sense for focus to initially jump to the revisions dropdown menu.
@@ -180,6 +182,12 @@ const NoteRevisionViewerComponent: React.FC<Props> = ({ themeId, noteId, onBack, | |||
|
|||
const viewer = <NoteTextViewer themeId={themeId} viewerStyle={{ display: 'flex', flex: 1, borderLeft: 'none' }} ref={viewerRef} onDomReady={viewer_domReady} onIpcMessage={webview_ipcMessage} />; | |||
|
|||
React.useEffect(() => { |
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.
No React.useEffect
please - just useEffect
@@ -180,6 +182,12 @@ const NoteRevisionViewerComponent: React.FC<Props> = ({ themeId, noteId, onBack, | |||
|
|||
const viewer = <NoteTextViewer themeId={themeId} viewerStyle={{ display: 'flex', flex: 1, borderLeft: 'none' }} ref={viewerRef} onDomReady={viewer_domReady} onIpcMessage={webview_ipcMessage} />; | |||
|
|||
React.useEffect(() => { | |||
// We need to force focus here because the otherwise the focus is lost and goes back |
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.
// We need to force focus here because the otherwise the focus is lost and goes back | |
// We need to force focus here because otherwise the focus is lost and goes back |
Related to #10795
Summary
Previously when opening the Note History the focus of the page would go back to the start of the document. Here I'm using the
focus
utility to set it programmatically to the content of the Note History screen.WCAG
Guideline 2.4.3. Focus Order
Testing