Nav: Fix main a11y issues (#80309)

* refactor: add nav announcement for screenreader

* refactor: add aria label

* refactor: add more aria labels

* refactor: aria labels

* refactor: remove aria-labels

* refactor: add aria-live

* refactor: add translations

* refactor: repair empty message

* refactor: repair empty message

* refactor: remove translation of empty message

* refactor: clean up

* refactor: change translation
This commit is contained in:
Laura Benz 2024-01-23 12:02:48 +01:00 committed by GitHub
parent 96c4b7bf1e
commit 5b6a4e880b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 10 additions and 2 deletions

View File

@ -60,7 +60,7 @@ export const MegaMenu = React.memo(
</div>
<nav className={styles.content}>
<CustomScrollbar showScrollIndicators hideHorizontalTrack>
<ul className={styles.itemList}>
<ul className={styles.itemList} aria-label={t('navigation.megamenu.list-label', 'Navigation')}>
{navItems.map((link, index) => (
<Stack key={link.text} direction={index === 0 ? 'row-reverse' : 'row'} alignItems="center">
{index === 0 && (

View File

@ -121,7 +121,9 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick }: Props) {
/>
))
) : (
<div className={styles.emptyMessage}>{link.emptyMessage}</div>
<div className={styles.emptyMessage} aria-live="polite">
{link.emptyMessage}
</div>
)}
</ul>
)}

View File

@ -974,6 +974,7 @@
"megamenu": {
"close": "Menü schließen",
"dock": "Menü andocken",
"list-label": "",
"undock": ""
},
"toolbar": {

View File

@ -974,6 +974,7 @@
"megamenu": {
"close": "Close menu",
"dock": "Dock menu",
"list-label": "Navigation",
"undock": "Undock menu"
},
"toolbar": {

View File

@ -980,6 +980,7 @@
"megamenu": {
"close": "Cerrar menú",
"dock": "Anclar el menú",
"list-label": "",
"undock": "Desanclar el menú"
},
"toolbar": {

View File

@ -980,6 +980,7 @@
"megamenu": {
"close": "Fermer le menu",
"dock": "Ancrer le menu",
"list-label": "",
"undock": ""
},
"toolbar": {

View File

@ -974,6 +974,7 @@
"megamenu": {
"close": "Cľőşę męʼnū",
"dock": "Đőčĸ męʼnū",
"list-label": "Ńävįģäŧįőʼn",
"undock": "Ůʼnđőčĸ męʼnū"
},
"toolbar": {

View File

@ -968,6 +968,7 @@
"megamenu": {
"close": "关闭菜单",
"dock": "停靠菜单",
"list-label": "",
"undock": ""
},
"toolbar": {