mirror of https://github.com/vector-im/riot-web
Add aria labels to menu options
parent
02095389e7
commit
35e4d89545
|
@ -26,8 +26,9 @@ interface IProps extends React.ComponentProps<typeof AccessibleButton> {
|
||||||
|
|
||||||
// Semantic component for representing a role=menuitem
|
// Semantic component for representing a role=menuitem
|
||||||
export const MenuItem: React.FC<IProps> = ({children, label, ...props}) => {
|
export const MenuItem: React.FC<IProps> = ({children, label, ...props}) => {
|
||||||
|
const ariaLabel = props["aria-label"] || label;
|
||||||
return (
|
return (
|
||||||
<AccessibleButton {...props} role="menuitem" tabIndex={-1} aria-label={label}>
|
<AccessibleButton {...props} role="menuitem" tabIndex={-1} aria-label={ariaLabel}>
|
||||||
{ children }
|
{ children }
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
);
|
);
|
||||||
|
|
|
@ -322,6 +322,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
<IconizedContextMenuOption
|
<IconizedContextMenuOption
|
||||||
iconClassName="mx_UserMenu_iconSettings"
|
iconClassName="mx_UserMenu_iconSettings"
|
||||||
label={_t("Settings")}
|
label={_t("Settings")}
|
||||||
|
aria-label={_t("Community settings")}
|
||||||
onClick={this.onCommunitySettingsClick}
|
onClick={this.onCommunitySettingsClick}
|
||||||
/>
|
/>
|
||||||
<IconizedContextMenuOption
|
<IconizedContextMenuOption
|
||||||
|
@ -353,6 +354,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
<IconizedContextMenuOption
|
<IconizedContextMenuOption
|
||||||
iconClassName="mx_UserMenu_iconSettings"
|
iconClassName="mx_UserMenu_iconSettings"
|
||||||
label={_t("Settings")}
|
label={_t("Settings")}
|
||||||
|
aria-label={_t("User settings")}
|
||||||
onClick={(e) => this.onSettingsOpen(e, null)}
|
onClick={(e) => this.onSettingsOpen(e, null)}
|
||||||
/>
|
/>
|
||||||
<IconizedContextMenuOption
|
<IconizedContextMenuOption
|
||||||
|
|
|
@ -2125,6 +2125,8 @@
|
||||||
"Security & privacy": "Security & privacy",
|
"Security & privacy": "Security & privacy",
|
||||||
"All settings": "All settings",
|
"All settings": "All settings",
|
||||||
"Feedback": "Feedback",
|
"Feedback": "Feedback",
|
||||||
|
"Community settings": "Community settings",
|
||||||
|
"User settings": "User settings",
|
||||||
"Switch to light mode": "Switch to light mode",
|
"Switch to light mode": "Switch to light mode",
|
||||||
"Switch to dark mode": "Switch to dark mode",
|
"Switch to dark mode": "Switch to dark mode",
|
||||||
"Switch theme": "Switch theme",
|
"Switch theme": "Switch theme",
|
||||||
|
|
Loading…
Reference in New Issue