Skip to content

Commit f9aceb3

Browse files
Add ariaDisabled prop to button (#11236)
aria-disabled uses the ariaDisabled or disabled props to inform screen readers that the button is dimmed or unavailable etc. Remove title from undo / redo buttons as aria-label is present. Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
1 parent 4d4719b commit f9aceb3

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

webapp/src/editortoolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ export class EditorToolbar extends data.Component<ISettingsProps, EditorToolbarS
172172
const hasUndo = this.props.parent.editor.hasUndo();
173173
const hasRedo = this.props.parent.editor.hasRedo();
174174
return [
175-
<EditorToolbarButton icon='xicon undo' className={`editortools-btn undo-editortools-btn ${!hasUndo ? 'disabled' : ''}`} title={lf("Undo")} ariaLabel={lf("{0}, {1}", lf("Undo"), !hasUndo ? lf("Disabled") : "")} onButtonClick={this.undo} view={this.getViewString(view)} key="undo" />,
176-
<EditorToolbarButton icon='xicon redo' className={`editortools-btn redo-editortools-btn ${!hasRedo ? 'disabled' : ''}`} title={lf("Redo")} ariaLabel={lf("{0}, {1}", lf("Redo"), !hasRedo ? lf("Disabled") : "")} onButtonClick={this.redo} view={this.getViewString(view)} key="redo" />
175+
<EditorToolbarButton icon='xicon undo' className={`editortools-btn undo-editortools-btn ${!hasUndo ? 'disabled' : ''}`} ariaDisabled={!hasUndo} ariaLabel={lf("{0}, {1}", lf("Undo"), !hasUndo ? lf("Disabled") : "")} onButtonClick={this.undo} view={this.getViewString(view)} key="undo" />,
176+
<EditorToolbarButton icon='xicon redo' className={`editortools-btn redo-editortools-btn ${!hasRedo ? 'disabled' : ''}`} ariaDisabled={!hasRedo} ariaLabel={lf("{0}, {1}", lf("Redo"), !hasRedo ? lf("Disabled") : "")} onButtonClick={this.redo} view={this.getViewString(view)} key="redo" />
177177
];
178178
}
179179

webapp/src/sui.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ export interface ButtonProps extends UiProps, TooltipUIProps {
511511
id?: string;
512512
title?: string;
513513
ariaLabel?: string;
514+
ariaDisabled?: boolean;
514515
ariaExpanded?: boolean;
515516
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
516517
disabled?: boolean;
@@ -539,6 +540,7 @@ export class Button extends StatelessUIElement<ButtonProps> {
539540
tabIndex={this.props.tabIndex || 0}
540541
aria-label={this.props.ariaLabel}
541542
aria-expanded={this.props.ariaExpanded}
543+
aria-disabled={this.props.ariaDisabled ?? disabled}
542544
onClick={this.props.onClick}
543545
onKeyDown={this.props.onKeyDown}
544546
autoFocus={this.props.autoFocus}

0 commit comments

Comments
 (0)