Skip to content

Commit 318e67c

Browse files
committed
[#46] ♻️ Enhance accessibility and fix typos
1 parent ede6c9f commit 318e67c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/common/switch/Switch.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import clsx from 'clsx'
22

33
import { handleKeyDown } from '@/utils/handleKeyDown'
44

5-
interface SwtichProps {
5+
interface SwitchProps {
66
isOn: boolean
77
disabled?: boolean
88
label?: string
@@ -17,7 +17,7 @@ export const Switch = ({
1717
disabled = false,
1818
label,
1919
onToggle,
20-
}: SwtichProps): JSX.Element => {
20+
}: SwitchProps): JSX.Element => {
2121
const buttonClass = clsx(
2222
'relative inline-flex h-30 w-50 items-center rounded-full transition-colors duration-300',
2323
isOn ? 'bg-primary-normal' : 'bg-gray-300',
@@ -33,7 +33,8 @@ export const Switch = ({
3333
<label className={containerClass}>
3434
<div
3535
role='button'
36-
aria-label='toggle button'
36+
aria-label={`toggle button ${isOn ? 'on' : 'off'}`}
37+
aria-pressed={isOn}
3738
tabIndex={0}
3839
onClick={!disabled ? onToggle : undefined}
3940
onKeyDown={e => handleKeyDown(e, onToggle, disabled)}

0 commit comments

Comments
 (0)