Make checkbox accessible from keyboard

This commit is contained in:
Sebastian Sdorra
2020-08-31 15:45:31 +02:00
committed by René Pfeuffer
parent be0c190f10
commit 6ba090b82e
3 changed files with 69 additions and 30 deletions

View File

@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix text-overflow in danger zone ([#1298](https://github.com/scm-manager/scm-manager/pull/1298)) - Fix text-overflow in danger zone ([#1298](https://github.com/scm-manager/scm-manager/pull/1298))
- Fix plugin installation error if previously a plugin was installed with the same dependency which is still pending. ([#1300](https://github.com/scm-manager/scm-manager/pull/1300)) - Fix plugin installation error if previously a plugin was installed with the same dependency which is still pending. ([#1300](https://github.com/scm-manager/scm-manager/pull/1300))
- Fix layout overflow on changesets with multiple tags ([#1314](https://github.com/scm-manager/scm-manager/pull/1314)) - Fix layout overflow on changesets with multiple tags ([#1314](https://github.com/scm-manager/scm-manager/pull/1314))
- Make checkbox accessible from keyboard ([#1309](https://github.com/scm-manager/scm-manager/pull/1309))
- Fix logging of large stacktrace for unknown language ([#1313](https://github.com/scm-manager/scm-manager/pull/1313)) - Fix logging of large stacktrace for unknown language ([#1313](https://github.com/scm-manager/scm-manager/pull/1313))
- Fix incorrect word breaking behaviour in markdown ([1317](https://github.com/scm-manager/scm-manager/pull/1317)) - Fix incorrect word breaking behaviour in markdown ([1317](https://github.com/scm-manager/scm-manager/pull/1317))
- Remove obsolete revision encoding on sources ([#1315](https://github.com/scm-manager/scm-manager/pull/1315)) - Remove obsolete revision encoding on sources ([#1315](https://github.com/scm-manager/scm-manager/pull/1315))

View File

@@ -44048,11 +44048,16 @@ exports[`Storyshots Forms|Checkbox Default 1`] = `
> >
<label <label
className="checkbox" className="checkbox"
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-square has-text-black far" className="is-outlined fa-square has-text-black far"
/> />
</span>
Not checked Not checked
</label> </label>
</div> </div>
@@ -44066,11 +44071,16 @@ exports[`Storyshots Forms|Checkbox Default 1`] = `
> >
<label <label
className="checkbox" className="checkbox"
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-check-square has-text-link fa" className="is-outlined fa-check-square has-text-link fa"
/> />
</span>
Checked Checked
</label> </label>
</div> </div>
@@ -44084,11 +44094,16 @@ exports[`Storyshots Forms|Checkbox Default 1`] = `
> >
<label <label
className="checkbox" className="checkbox"
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-minus-square has-text-link far" className="is-outlined fa-minus-square has-text-link far"
/> />
</span>
Indeterminate Indeterminate
</label> </label>
</div> </div>
@@ -44110,11 +44125,16 @@ exports[`Storyshots Forms|Checkbox Disabled 1`] = `
<label <label
className="checkbox" className="checkbox"
disabled={true} disabled={true}
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-check-square has-text-grey-light fa" className="is-outlined fa-check-square has-text-grey-light fa"
/> />
</span>
Checked but disabled Checked but disabled
</label> </label>
</div> </div>
@@ -44135,11 +44155,16 @@ exports[`Storyshots Forms|Checkbox With HelpText 1`] = `
> >
<label <label
className="checkbox" className="checkbox"
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-square has-text-black far" className="is-outlined fa-square has-text-black far"
/> />
</span>
Classic helpText Classic helpText
<span <span
className="tooltip has-tooltip-right Help__HelpTooltip-ykmmew-0 cYhfno is-inline-block has-tooltip-multiline" className="tooltip has-tooltip-right Help__HelpTooltip-ykmmew-0 cYhfno is-inline-block has-tooltip-multiline"
@@ -44161,11 +44186,16 @@ exports[`Storyshots Forms|Checkbox With HelpText 1`] = `
> >
<label <label
className="checkbox" className="checkbox"
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-check-square has-text-link fa" className="is-outlined fa-check-square has-text-link fa"
/> />
</span>
Long helpText Long helpText
<span <span
className="tooltip has-tooltip-right Help__HelpTooltip-ykmmew-0 cYhfno is-inline-block has-tooltip-multiline" className="tooltip has-tooltip-right Help__HelpTooltip-ykmmew-0 cYhfno is-inline-block has-tooltip-multiline"
@@ -47540,11 +47570,16 @@ exports[`Storyshots Modal|Modal With long tooltips 1`] = `
> >
<label <label
className="checkbox" className="checkbox"
>
<span
className="gwt-Anchor"
tabIndex={0}
> >
<i <i
className="is-outlined fa-check-square has-text-link fa" className="is-outlined fa-check-square has-text-link fa"
/> />
</span>
Checkbox Checkbox
<span <span
className="tooltip has-tooltip-right Help__HelpTooltip-ykmmew-0 cYhfno is-inline-block has-tooltip-multiline" className="tooltip has-tooltip-right Help__HelpTooltip-ykmmew-0 cYhfno is-inline-block has-tooltip-multiline"

View File

@@ -58,10 +58,13 @@ const TriStateCheckbox: FC<Props> = ({ checked, indeterminate, disabled, label,
color = "black"; color = "black";
} }
// We need a tabIndex to make the checkbox accessible from keyboard.
// We also add the gwt-Anchor css class to support the key-jump browser extension
// https://github.com/KennethSundqvist/key-jump-chrome-extension/blob/master/src/content.js#L365
return ( return (
<> <span tabIndex={0} className="gwt-Anchor">
<Icon iconStyle={"is-outlined"} name={icon} className={className} color={color} testId={testId} /> {label} <Icon iconStyle={"is-outlined"} name={icon} className={className} color={color} testId={testId} /> {label}
</> </span>
); );
}; };