Skip to content

Commit

Permalink
Fix accessibility issue in the settings modal
Browse files Browse the repository at this point in the history
  • Loading branch information
tnajdek committed Nov 20, 2024
1 parent 8e54a29 commit 691b73c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/js/component/modal/settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const densityOptions = [

const SettingsModal = () => {
const dispatch = useDispatch();
const isTouchOrSmall = useSelector(state => state.device.isTouchOrSmall);
const colorScheme = useSelector(state => state.preferences.colorScheme ?? '');
const density = useSelector(state => state.preferences.density ?? '');
const useDarkModeForContent = useSelector(state => colorScheme !== 'light' && (state.preferences.useDarkModeForContent ?? true));
Expand Down Expand Up @@ -80,14 +81,16 @@ const SettingsModal = () => {
<div className="form">
<div className={cx("form-group", { disabled: isSmall })}>
<label
id={`${densityInputId.current}-label`}
className="col-form-label"
htmlFor={densityInputId.current}
htmlFor={isTouchOrSmall ? densityInputId.current : null}
>
UI Density
</label>
<div className="col">
<Select
isDisabled={isSmall}
aria-labelledby={isTouchOrSmall ? null : `${densityInputId.current}-label` }
id={densityInputId.current}
className="form-control form-control-sm"
onChange={handleChange}
Expand All @@ -100,13 +103,15 @@ const SettingsModal = () => {
</div>
<div className="form-group">
<label
id={`${colorSchemeInputId.current}-label`}
className="col-form-label"
htmlFor={colorSchemeInputId.current}
htmlFor={isTouchOrSmall ? colorSchemeInputId.current : null}
>
Color Scheme
</label>
<div className="col">
<Select
aria-labelledby={isTouchOrSmall ? null : `${colorSchemeInputId.current}-label`}
id={colorSchemeInputId.current}
className="form-control form-control-sm"
onChange={handleChange}
Expand Down

0 comments on commit 691b73c

Please sign in to comment.