Skip to content

Conversation

@dharmveer97
Copy link

@dharmveer97 dharmveer97 commented Nov 1, 2025

Closes #5863

📝 Description

This PR removes the deprecated isDisabled and isSelected props from ListboxItem and AutocompleteItem components. These props were deprecated in react-aria's AriaOptionProps interface and should no longer be exposed to users.

⛳️ Current behavior (updates)

Currently, ListboxItem and AutocompleteItem inherit all props from react-aria's AriaOptionProps, including the deprecated isDisabled and isSelected props. This allows users to write code like:

<Autocomplete>
  <AutocompleteItem key="penguin" isDisabled>
    Penguin
  </AutocompleteItem>
</Autocomplete>

However, this pattern is deprecated in react-aria and triggers deprecation warnings in TypeScript.

🚀 New behavior

After this PR, the deprecated props are excluded from the type definition. Users must use the disabledKeys prop on the parent component instead:

<Autocomplete disabledKeys={["penguin"]}>
  <AutocompleteItem key="penguin">
    Penguin
  </AutocompleteItem>
</Autocomplete>

This approach:

  • ✅ Eliminates deprecation warnings
  • ✅ Follows react-aria's recommended patterns
  • ✅ Centralizes disabled state management
  • ✅ Provides better consistency with accessibility patterns

Changes made:

  • Excluded isDisabled and isSelected from AriaOptionProps inheritance in ListboxItemBaseProps
  • Updated test file to use the correct disabledKeys pattern
  • Added changeset documenting the change

💣 Is this a breaking change (Yes/No):

Yes - Minor breaking change

Impact

Users who are using isDisabled or isSelected props directly on ListboxItem or AutocompleteItem will get TypeScript errors after this update.

Migration Path

Replace individual item isDisabled props with the disabledKeys prop on the parent component:

Before:

<Autocomplete>
  <AutocompleteItem key="cat" isDisabled>Cat</AutocompleteItem>
  <AutocompleteItem key="dog">Dog</AutocompleteItem>
</Autocomplete>

After:

<Autocomplete disabledKeys={["cat"]}>
  <AutocompleteItem key="cat">Cat</AutocompleteItem>
  <AutocompleteItem key="dog">Dog</AutocompleteItem>
</Autocomplete>

This pattern works for all components using ListboxItem: Autocomplete, Select, Listbox, Dropdown, etc.

📝 Additional Information

  • This aligns HeroUI with react-aria's current best practices
  • The disabledKeys pattern has been the recommended approach and is already widely used in the codebase
  • All existing examples and documentation already use disabledKeys, so most users should not be affected
  • Related react-aria issue: The isDisabled prop in AriaOptionProps was marked as deprecated to encourage centralized disabled state management

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Removed deprecated isDisabled and isSelected props from listbox and autocomplete item components. Manage disabled state via the parent component's disabledKeys prop instead.
  • Documentation

    • Updated usage guidance and examples to reflect the new disabled state management pattern.

jrgarciadev and others added 4 commits September 9, 2025 15:51
…eroui-inc#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
@changeset-bot
Copy link

changeset-bot bot commented Nov 1, 2025

🦋 Changeset detected

Latest commit: 0dd973a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@heroui/listbox Patch
@heroui/autocomplete Patch
@heroui/select Patch
@heroui/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 1, 2025

@dharmveer97 is attempting to deploy a commit to the HeroUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Walkthrough

This pull request removes the deprecated isDisabled and isSelected props from ListboxItemBase and AutocompleteItem components, redirecting users to manage disabled state via the parent component's disabledKeys prop. Additionally, the docs layout is updated to replace RandomBanner with ProBanner.

Changes

Cohort / File(s) Summary
Deprecated Props Removal
packages/components/listbox/src/base/listbox-item-base.tsx
Updated ListboxItemBaseProps type to omit isDisabled and isSelected from AriaOptionProps, in addition to existing key omission
Test Updates
packages/components/autocomplete/__tests__/autocomplete.test.tsx
Removed isDisabled prop from AutocompleteItem in test case; item now rendered as enabled
Changeset Documentation
.changeset/remove-deprecated-isdisabled-prop.md
Documented removal of deprecated isDisabled and isSelected props with migration guidance to use parent disabledKeys; bumped @heroui/listbox and @heroui/autocomplete to patch versions
Docs Layout
apps/docs/app/layout.tsx
Replaced RandomBanner import and usage with ProBanner in RootLayout component

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Type changes in ListboxItemBaseProps are straightforward omissions from the AriaOptionProps interface
  • Test update is a single prop removal demonstrating the migration path
  • Changes are localized and non-breaking from an external API perspective (props are being removed per deprecation notice)

Possibly related PRs

Suggested reviewers

  • jrgarciadev
  • wingkwong

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR contains an out-of-scope change in apps/docs/app/layout.tsx that replaces RandomBanner with ProBanner. This documentation layout modification is unrelated to the stated objective of removing deprecated isDisabled and isSelected props from ListboxItem and AutocompleteItem components, and appears to be an accidental inclusion that should be removed or addressed in a separate PR to maintain PR focus and reviewability. Remove the apps/docs/app/layout.tsx change (RandomBanner to ProBanner replacement) from this PR as it is unrelated to the deprecated props removal objective. If this change is necessary, please address it in a separate pull request to keep this PR focused on its stated goal.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Fix/listbox remove deprecated isdisabled" captures the core objective of removing deprecated props from listbox-related components. However, the title is somewhat incomplete as it omits reference to the isSelected prop that is also being removed and does not clearly indicate that the changes affect both Listbox and Autocomplete components. While the title could be more comprehensive, it remains clear and specific enough to convey the primary change without being vague or generic.
Linked Issues Check ✅ Passed The PR successfully addresses the primary objective of issue #5863 by removing the deprecated isDisabled and isSelected props that were inherited from react-aria's AriaOptionProps. The implementation prevents users from accessing deprecated properties and provides a valid migration path using the parent component's disabledKeys prop, which aligns with react-aria's recommended patterns. While the issue suggested isReadonly as an alternative, the PR's approach using disabledKeys is the established best practice in the codebase and effectively resolves the deprecation issue.
Description Check ✅ Passed The PR description comprehensively addresses all required template sections: it includes the issue reference (Closes #5863), provides a clear description of the problem, explains both current and new behavior with code examples, explicitly marks this as a breaking change with detailed impact and migration guidance, and offers additional context about alignment with react-aria best practices. The description is well-organized, thorough, and provides sufficient information for reviewers and future maintainers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27fec2d and 0dd973a.

📒 Files selected for processing (4)
  • .changeset/remove-deprecated-isdisabled-prop.md (1 hunks)
  • apps/docs/app/layout.tsx (2 hunks)
  • packages/components/autocomplete/__tests__/autocomplete.test.tsx (1 hunks)
  • packages/components/listbox/src/base/listbox-item-base.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/docs/app/layout.tsx (1)
apps/docs/components/pro-banner.tsx (1)
  • ProBanner (13-117)
🔇 Additional comments (3)
packages/components/autocomplete/__tests__/autocomplete.test.tsx (1)

982-984: LGTM! Test correctly updated to use parent-level disabledKeys.

The test has been properly migrated from using per-item isDisabled prop to the parent component's disabledKeys pattern. The test logic remains valid and correctly verifies that focus moves to the first non-disabled item when the first item is disabled.

.changeset/remove-deprecated-isdisabled-prop.md (1)

1-24: Excellent changeset documentation with clear migration guide.

The changeset provides:

  • Clear description of the change
  • Concrete before/after code examples
  • Proper issue reference (#5863)

The migration path is straightforward and well-documented, making it easy for users to update their code.

packages/components/listbox/src/base/listbox-item-base.tsx (1)

95-95: Now let me search for HeroUI v2's specific versioning policy for handling deprecated property removals:

Let me check the PR's changeset file to see what version bump type is specified:

Based on my research, I need to provide a definitive assessment. Semantic Versioning specifies that major version must be incremented if any backward incompatible changes are introduced to the public API. However, Semantic Versioning's deprecation guidance recommends that when deprecating functionality, you should issue a new minor release with the deprecation in place, and removal should occur in a new major release.

HeroUI's actual practice differs: HeroUI v2.7.0 shipped with ListboxItem, SelectItem & AutocompleteItem no longer accepting certain props and these were listed as breaking changes in a release that bumped the minor version (2.6.0 → 2.7.0).

Clarify the changeset version bump type.

The review concern about patch vs. major versioning has merit, but the actual answer depends on which versioning component this PR uses. If the changeset marks this as a "patch" bump (incrementing Z in X.Y.Z), that would contradict both strict semver and HeroUI's own practice. If it's marked as "minor" (incrementing Y), it would align with HeroUI's demonstrated convention for breaking prop removals, though it deviates from strict semver. Verify the changeset file's version bump designation (patch, minor, or major) to confirm whether it follows HeroUI's established pattern or requires adjustment.

import {Navbar} from "@/components/navbar";
import {Footer} from "@/components/footer";
import {RandomBanner} from "@/components/random-banner";
import {ProBanner} from "@/components/pro-banner";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

This change appears unrelated to the PR objectives.

The PR objectives state this PR "removes the deprecated isDisabled and isSelected props from ListboxItem and AutocompleteItem" and closes issue #5863 about deprecated props. However, this file changes the docs site banner component from RandomBanner to ProBanner, which is unrelated to the component API changes.

Consider moving this docs site improvement to a separate PR to keep changes focused and make the review clearer.

Also applies to: 86-86

🤖 Prompt for AI Agents
In apps/docs/app/layout.tsx around lines 16 and 86 the import and usage were
changed from the docs' RandomBanner to ProBanner, which is unrelated to removing
deprecated isDisabled/isSelected props; revert the import and any usage back to
the original RandomBanner (restore the prior import line and component reference
at the indicated lines) so the PR only contains the component API changes, and
move the ProBanner/docs banner update into a separate PR for the docs
improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - isDisabled for AutocompleteItem is deprecated in react-aria

3 participants