-
Notifications
You must be signed in to change notification settings - Fork 472
♿(frontend) add missing label and fix Axes errors to improve a11y #1693
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
base: main
Are you sure you want to change the base?
Conversation
d13f89f to
4d7b2cf
Compare
…hecks enhances a11y by adding label to fix axe tool errors on missing attributes Signed-off-by: Cyril <[email protected]>
4d7b2cf to
b8a5e53
Compare
|
Size Change: +138 B (0%) Total Size: 4.11 MB
|
| aria-label={t(emoji ? 'Edit document emoji' : 'Add emoji')} | ||
| title={t(emoji ? 'Edit document emoji' : 'Add emoji')} |
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.
The parser cannot extract the translation if the ternaire is inside the t
| aria-label={t(emoji ? 'Edit document emoji' : 'Add emoji')} | |
| title={t(emoji ? 'Edit document emoji' : 'Add emoji')} | |
| aria-label={emoji ? t('Edit document emoji') : t('Add emoji')} | |
| title={emoji ? t('Edit document emoji') : t('Add emoji')} |
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.
There is cases where we cannot add emoji, so t('Add emoji') should not be everytime as a fallback, it depends if the user has the editing rights.
docs/src/frontend/apps/impress/src/features/docs/doc-header/components/DocTitle.tsx
Line 87 in 8036f16
| withEmojiPicker={doc.abilities.partial_update} |
| editor={editor} | ||
| editable={false} | ||
| theme="light" | ||
| aria-label={t('Document viewer')} |
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.
You will not have any aria-label here so.
| useEffect(() => { | ||
| if (!refEditorContainer.current) { | ||
| return; | ||
| } | ||
|
|
||
| const setEditorAriaAttributes = () => { | ||
| const editorElement = | ||
| refEditorContainer.current?.querySelector<HTMLElement>( | ||
| '.ProseMirror.bn-editor[contenteditable="true"]', | ||
| ); | ||
|
|
||
| if (!editorElement) { | ||
| return; | ||
| } | ||
|
|
||
| const label = t('Document editor'); | ||
|
|
||
| editorElement.setAttribute('aria-label', label); | ||
| editorElement.setAttribute('title', label); | ||
| }; | ||
|
|
||
| setEditorAriaAttributes(); | ||
|
|
||
| const observer = new MutationObserver(() => { | ||
| setEditorAriaAttributes(); | ||
| }); | ||
|
|
||
| observer.observe(refEditorContainer.current, { | ||
| childList: true, | ||
| subtree: true, | ||
| }); | ||
|
|
||
| return () => { | ||
| observer.disconnect(); | ||
| }; | ||
| }, [t]); | ||
|
|
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.
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.


Purpose
Fix several Axe accessibility issues (landmarks, button names, editor label, modals).
Proposal
/homeoutside of<main>socontentinfois a sibling landmark.aria-label/titleto icon-only buttons (e.g. document emoji) so they have discernible text.BlockNoteEditor, label the real editable node.ProseMirror.bn-edito and removearia-labelfromBlockNoteView`. s aDocShareModal.tsx