From: Daniel Karbach Date: Wed, 30 Jul 2025 20:36:27 +0000 (+0200) Subject: refine toggle switch a11y X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=49095322c5fbf89de4e0fa46f6de2e4167f988a1;p=alttp.git refine toggle switch a11y --- diff --git a/resources/js/components/common/ToggleSwitch.jsx b/resources/js/components/common/ToggleSwitch.jsx index 22bb752..f9d4838 100644 --- a/resources/js/components/common/ToggleSwitch.jsx +++ b/resources/js/components/common/ToggleSwitch.jsx @@ -26,14 +26,6 @@ const ToggleSwitch = ({ toggle(); }; - const handleKey = event => { - if ([13, 32].includes(event.which)) { - toggle(); - event.preventDefault(); - event.stopPropagation(); - } - }; - const classNames = ['form-control', 'custom-toggle']; if (value) classNames.push('is-toggled'); if (isInvalid) classNames.push('is-invalid'); @@ -44,11 +36,9 @@ const ToggleSwitch = ({ aria-checked={value ? 'true' : 'false'} className={classNames.join(' ')} id={id} - role="switch" onBlur={onBlur ? () => onBlur({ target: { name, value } }) : null} onClick={handleClick} - onKeyDown={handleKey} - tabIndex="0" + role="switch" title={title} type="button" >