Skip to content

Commit

Permalink
Fixed a11y issue with narration of checkboxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Nov 25, 2019
1 parent 87af526 commit 105720d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [1999](https://github.com/microsoft/BotFramework-Emulator/pull/1999)
- [2000](https://github.com/microsoft/BotFramework-Emulator/pull/2000)
- [2009](https://github.com/microsoft/BotFramework-Emulator/pull/2009)
- [2010](https://github.com/microsoft/BotFramework-Emulator/pull/2010)

- [main] Increased ngrok spawn timeout to 15 seconds to be more forgiving to slower networks in PR [1998](https://github.com/microsoft/BotFramework-Emulator/pull/1998)

Expand Down
14 changes: 7 additions & 7 deletions packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx
Expand Up @@ -74,7 +74,7 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {

public render(): React.ReactNode {
// Trim off what we don't want to send to the input tag
const { className, label = '', ...inputProps } = this.props;
const { className, label = '', id, ...inputProps } = this.props;
const { checked = false, indeterminate = false, focused } = this.state;
const { disabled } = inputProps;
const disabledClass = disabled ? styles.disabled : '';
Expand All @@ -88,19 +88,19 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
checkMarkStyles += ` ${styles.focused}`;
}
return (
<label id={this.checkboxId} className={`${styles.label} ${disabledClass} ${className}`} data-checked={checked}>
<div className={`${styles.label} ${disabledClass} ${className}`} data-checked={checked} role="presentation">
<span className={`${styles.checkMark} ${checkMarkStyles}`} />
<input
aria-label={label}
type="checkbox"
{...inputProps}
className={styles.checkbox}
id={id || this.checkboxId}
ref={this.checkboxRef}
readOnly={true}
type="checkbox"
{...inputProps}
/>
{label}
<label htmlFor={id || this.checkboxId}>{label}</label>
{this.props.children}
</label>
</div>
);
}

Expand Down

0 comments on commit 105720d

Please sign in to comment.