Skip to content

Commit b3a508b

Browse files
authored
Prevent focus on <Checkbox /> when it is disabled (#3251)
* prevent focus on `<Checkbox />` when disabled * update changelog
1 parent 94bc4e1 commit b3a508b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/@headlessui-react/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- Keep `<Combobox />` open when clicking scrollbar in `<ComboboxOptions>` ([#3249](https://github.com/tailwindlabs/headlessui/pull/3249))
1717
- Merge incoming `style` prop on `ComboboxOptions`, `ListboxOptions`, `MenuItems`, and `PopoverPanel` components ([#3250](https://github.com/tailwindlabs/headlessui/pull/3250))
18+
- Prevent focus on `<Checkbox />` when it is `disabled` ([#3251](https://github.com/tailwindlabs/headlessui/pull/3251))
1819

1920
## [2.0.4] - 2024-05-25
2021

packages/@headlessui-react/src/components/checkbox/checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function CheckboxFn<TTag extends ElementType = typeof DEFAULT_CHECKBOX_TAG, TTyp
148148
'aria-describedby': describedBy,
149149
'aria-disabled': disabled ? true : undefined,
150150
indeterminate: indeterminate ? 'true' : undefined,
151-
tabIndex: 0,
151+
tabIndex: disabled ? undefined : 0,
152152
onKeyUp: disabled ? undefined : handleKeyUp,
153153
onKeyPress: disabled ? undefined : handleKeyPress,
154154
onClick: disabled ? undefined : handleClick,

0 commit comments

Comments
 (0)