Dropdown button aria attributes

This commit is contained in:
tidy-dev 2023-08-22 14:54:52 -04:00
parent 8450d2ac67
commit e0789094f4
4 changed files with 10 additions and 1 deletions

View file

@ -31,6 +31,9 @@ interface IDropdownSelectButtonProps<T extends string> {
/** tooltip for the button */
readonly tooltip?: string
/** aria label for the button */
readonly dropdownAriaLabel: string
/** Callback for when the button selection changes*/
readonly onCheckedOptionChange?: (
selectedOption: IDropdownSelectButtonOption<T>
@ -237,7 +240,7 @@ export class DropdownSelectButton<
}
public render() {
const { options, disabled } = this.props
const { options, disabled, dropdownAriaLabel } = this.props
const {
checkedOption: selectedOption,
optionsPositionBottom,
@ -274,6 +277,9 @@ export class DropdownSelectButton<
className={dropdownClasses}
onClick={this.openSplitButtonDropdown}
type="button"
ariaExpanded={showButtonOptions}
ariaHaspopup={true}
ariaLabel={dropdownAriaLabel}
>
<Octicon symbol={OcticonSymbol.triangleDown} />
</Button>

View file

@ -183,6 +183,7 @@ export class MergeCallToActionWithConflicts extends React.Component<
<DropdownSelectButton
checkedOption={this.state.selectedOperation}
options={getMergeOptions()}
dropdownAriaLabel="Merge options"
disabled={disabled}
onCheckedOptionChange={this.onOperationChange}
onSubmit={this.onOperationInvoked}

View file

@ -243,6 +243,7 @@ export abstract class BaseChooseBranchDialog extends React.Component<
checkedOption={operation}
options={getMergeOptions()}
disabled={!this.canStart()}
dropdownAriaLabel="Merge options"
tooltip={this.getSubmitButtonToolTip()}
onCheckedOptionChange={this.onOperationChange}
/>

View file

@ -162,6 +162,7 @@ export class DropdownSuggestedAction<T extends string> extends React.Component<
value,
}))}
disabled={disabled}
dropdownAriaLabel="Suggested actions for this branch"
onCheckedOptionChange={this.onActionSelectionChange}
onSubmit={this.onActionSubmitted}
/>