Skip to content

Commit 0dd973a

Browse files
committed
fix(listbox): remove deprecated isDisabled prop from ListboxItem (fix #5863)
Remove deprecated `isDisabled` and `isSelected` props from `AriaOptionProps` inheritance in `ListboxItemBaseProps`. These props were deprecated in react-aria and should not be used on individual items. Users should use the `disabledKeys` prop on the parent component instead. Changes: - Remove `isDisabled` and `isSelected` from AriaOptionProps inheritance - Update test to use `disabledKeys` instead of `isDisabled` prop - Add changeset documenting the breaking change
1 parent 680b68b commit 0dd973a

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
"@heroui/listbox": patch
3+
"@heroui/autocomplete": patch
4+
---
5+
6+
fix(listbox): remove deprecated isDisabled prop from ListboxItem
7+
8+
Remove deprecated `isDisabled` and `isSelected` props from `AriaOptionProps` inheritance in `ListboxItemBaseProps`. These props were deprecated in react-aria and should not be used on individual items.
9+
10+
Users should use the `disabledKeys` prop on the parent Listbox/Autocomplete component instead:
11+
12+
```jsx
13+
// ❌ Before (deprecated)
14+
<Autocomplete>
15+
<AutocompleteItem isDisabled>Item</AutocompleteItem>
16+
</Autocomplete>
17+
18+
// ✅ After (correct)
19+
<Autocomplete disabledKeys={["item-key"]}>
20+
<AutocompleteItem key="item-key">Item</AutocompleteItem>
21+
</Autocomplete>
22+
```
23+
24+
Fixes #5863

packages/components/autocomplete/__tests__/autocomplete.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ describe("focusedKey management with selected key", () => {
979979
disabledKeys={["penguin"]}
980980
label="Favorite Animal"
981981
>
982-
<AutocompleteItem key="penguin" isDisabled>
982+
<AutocompleteItem key="penguin">
983983
Penguin
984984
</AutocompleteItem>
985985
<AutocompleteItem key="zebra">Zebra</AutocompleteItem>

packages/components/listbox/src/base/listbox-item-base.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
9292

9393
export type ListboxItemBaseProps<T extends object = {}> = Omit<Props<T>, "onClick"> &
9494
Omit<ListboxItemVariantProps, "hasDescriptionTextChild" | "hasTitleTextChild"> &
95-
Omit<AriaOptionProps, "key"> &
95+
Omit<AriaOptionProps, "key" | "isDisabled" | "isSelected"> &
9696
FocusableProps &
9797
PressEvents & {
9898
/**

0 commit comments

Comments
 (0)