Skip to content

fix(autocomplete): duplicate id in clear & selector button#5750

Merged
wingkwong merged 1 commit into
canaryfrom
fix/eng-2813
Oct 3, 2025
Merged

fix(autocomplete): duplicate id in clear & selector button#5750
wingkwong merged 1 commit into
canaryfrom
fix/eng-2813

Conversation

@wingkwong
Copy link
Copy Markdown
Member

@wingkwong wingkwong commented Sep 30, 2025

Closes #5738

📝 Description

⛳️ Current behavior (updates)

🚀 New behavior

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

📝 Additional Information

Summary by CodeRabbit

  • Bug Fixes
    • Autocomplete: Fixed duplicate ID on clear and selector buttons to avoid accessibility and interaction conflicts.
    • Updated clear button behavior to not take focus on press and be skipped in tab order, improving keyboard navigation. No visual changes.
  • Chores
    • Added changeset for a patch release of @heroui/autocomplete.

@linear
Copy link
Copy Markdown

linear Bot commented Sep 30, 2025

@wingkwong wingkwong added this to the v2.8.5 milestone Sep 30, 2025
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 30, 2025

🦋 Changeset detected

Latest commit: dc81692

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

This PR includes changesets to release 2 packages
Name Type
@heroui/autocomplete 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
Copy Markdown

vercel Bot commented Sep 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
heroui Ready Ready Preview Comment Sep 30, 2025 11:48am
heroui-sb Ready Ready Preview Comment Sep 30, 2025 11:48am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 30, 2025

Walkthrough

Introduces a changeset entry for @heroui/autocomplete and updates use-autocomplete to adjust clear button prop composition and focus/tab behavior by using only slotsProps.clearButtonProps and adding preventFocusOnPress and excludeFromTabOrder flags.

Changes

Cohort / File(s) Summary
Release notes
\.changeset/slow-maps-confess.md
Adds patch changeset for @heroui/autocomplete referencing a fix for duplicate id on clear/selector button (linked to #5738).
Autocomplete clear button behavior
packages/components/autocomplete/src/use-autocomplete.ts
getClearButtonProps now derives from slotsProps.clearButtonProps only; adds preventFocusOnPress: true and excludeFromTabOrder: true; existing handlers (onPressStart/onPress) and visibility/styling logic retained.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant CB as ClearButton
  participant AC as useAutocomplete
  participant IN as Input

  Note over CB,AC: Clear button props now include preventFocusOnPress=true and excludeFromTabOrder=true

  U->>CB: Click (press)
  CB->>AC: onPressStart / onPress
  AC->>AC: Clear value / update state
  AC-->>IN: Notify input state updated
  Note over U,CB: Focus is not moved to button (preventFocusOnPress)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • jrgarciadev
  • winchesHe

Pre-merge checks and finishing touches

❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The changes only adjust how clear button props are merged and add focus and tab-order flags but do not implement any logic to generate or enforce unique id attributes for autocomplete controls and options as required by issue #5738. Please add or modify the id generation logic for both the clear and selector buttons (and other autocomplete elements) to ensure each id is unique across instances, satisfying the ARIA requirement from issue #5738.
Out of Scope Changes Check ⚠️ Warning The pull request introduces focus handling and tab-order flags for the clear button that were not requested in issue #5738, which solely focused on fixing duplicate id generation; these behavior changes fall outside the stated objectives. Please remove or justify the added preventFocusOnPress and excludeFromTabOrder flags, ensuring that only the id uniqueness fix specified in issue #5738 is implemented.
Description Check ⚠️ Warning The pull request description includes the closes statement but lacks the mandatory sections from the template for Description, Current behavior, New behavior, Breaking change indication, and Additional Information, all of which are empty placeholders. Please complete each template section by providing a brief summary of the changes, describing the existing behavior and how it’s modified, indicating if this is a breaking change, and adding any pertinent details or context.
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 (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title accurately and concisely summarizes the primary change of fixing duplicate IDs in both clear and selector buttons of the autocomplete component, aligning directly with the implemented fix.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/eng-2813

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

Copy link
Copy Markdown
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 27c5129 and dc81692.

📒 Files selected for processing (2)
  • .changeset/slow-maps-confess.md (1 hunks)
  • packages/components/autocomplete/src/use-autocomplete.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: TypeScript
  • GitHub Check: ESLint
  • GitHub Check: Continuous Release
  • GitHub Check: Tests
  • GitHub Check: Build
🔇 Additional comments (2)
packages/components/autocomplete/src/use-autocomplete.ts (2)

437-445: Correctly retains buttonProps for the selector button.

The selector button correctly continues to merge buttonProps from useComboBox, as this button is the actual trigger/combobox button that needs the ID, ARIA attributes, and event handlers provided by React Aria.

The distinction is important:

  • Selector button: The main trigger button that opens/closes the dropdown - needs buttonProps
  • Clear button: A secondary action button - should NOT receive the same buttonProps (would cause duplicate IDs)

449-451: Remove buttonProps from clear button props
Merging buttonProps (which includes menu‐toggle ARIA attributes—aria-haspopup, aria-expanded, id—and event handlers for the combo‐box trigger) into the clear button was unnecessary. The clear button now correctly uses only slotsProps.clearButtonProps and adds preventFocusOnPress and excludeFromTabOrder to keep focus on the input and remove it from tab order. No essential ARIA attributes or event handlers have been omitted. (react-spectrum.adobe.com)

Comment thread .changeset/slow-maps-confess.md
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Sep 30, 2025

Open in StackBlitz

@heroui/accordion

npm i https://pkg.pr.new/@heroui/accordion@5750

@heroui/alert

npm i https://pkg.pr.new/@heroui/alert@5750

@heroui/autocomplete

npm i https://pkg.pr.new/@heroui/autocomplete@5750

@heroui/avatar

npm i https://pkg.pr.new/@heroui/avatar@5750

@heroui/badge

npm i https://pkg.pr.new/@heroui/badge@5750

@heroui/breadcrumbs

npm i https://pkg.pr.new/@heroui/breadcrumbs@5750

@heroui/button

npm i https://pkg.pr.new/@heroui/button@5750

@heroui/calendar

npm i https://pkg.pr.new/@heroui/calendar@5750

@heroui/card

npm i https://pkg.pr.new/@heroui/card@5750

@heroui/checkbox

npm i https://pkg.pr.new/@heroui/checkbox@5750

@heroui/chip

npm i https://pkg.pr.new/@heroui/chip@5750

@heroui/code

npm i https://pkg.pr.new/@heroui/code@5750

@heroui/date-input

npm i https://pkg.pr.new/@heroui/date-input@5750

@heroui/date-picker

npm i https://pkg.pr.new/@heroui/date-picker@5750

@heroui/divider

npm i https://pkg.pr.new/@heroui/divider@5750

@heroui/drawer

npm i https://pkg.pr.new/@heroui/drawer@5750

@heroui/dropdown

npm i https://pkg.pr.new/@heroui/dropdown@5750

@heroui/form

npm i https://pkg.pr.new/@heroui/form@5750

@heroui/image

npm i https://pkg.pr.new/@heroui/image@5750

@heroui/input

npm i https://pkg.pr.new/@heroui/input@5750

@heroui/input-otp

npm i https://pkg.pr.new/@heroui/input-otp@5750

@heroui/kbd

npm i https://pkg.pr.new/@heroui/kbd@5750

@heroui/link

npm i https://pkg.pr.new/@heroui/link@5750

@heroui/listbox

npm i https://pkg.pr.new/@heroui/listbox@5750

@heroui/menu

npm i https://pkg.pr.new/@heroui/menu@5750

@heroui/modal

npm i https://pkg.pr.new/@heroui/modal@5750

@heroui/navbar

npm i https://pkg.pr.new/@heroui/navbar@5750

@heroui/number-input

npm i https://pkg.pr.new/@heroui/number-input@5750

@heroui/pagination

npm i https://pkg.pr.new/@heroui/pagination@5750

@heroui/popover

npm i https://pkg.pr.new/@heroui/popover@5750

@heroui/progress

npm i https://pkg.pr.new/@heroui/progress@5750

@heroui/radio

npm i https://pkg.pr.new/@heroui/radio@5750

@heroui/ripple

npm i https://pkg.pr.new/@heroui/ripple@5750

@heroui/scroll-shadow

npm i https://pkg.pr.new/@heroui/scroll-shadow@5750

@heroui/select

npm i https://pkg.pr.new/@heroui/select@5750

@heroui/skeleton

npm i https://pkg.pr.new/@heroui/skeleton@5750

@heroui/slider

npm i https://pkg.pr.new/@heroui/slider@5750

@heroui/snippet

npm i https://pkg.pr.new/@heroui/snippet@5750

@heroui/spacer

npm i https://pkg.pr.new/@heroui/spacer@5750

@heroui/spinner

npm i https://pkg.pr.new/@heroui/spinner@5750

@heroui/switch

npm i https://pkg.pr.new/@heroui/switch@5750

@heroui/table

npm i https://pkg.pr.new/@heroui/table@5750

@heroui/tabs

npm i https://pkg.pr.new/@heroui/tabs@5750

@heroui/toast

npm i https://pkg.pr.new/@heroui/toast@5750

@heroui/tooltip

npm i https://pkg.pr.new/@heroui/tooltip@5750

@heroui/user

npm i https://pkg.pr.new/@heroui/user@5750

@heroui/react

npm i https://pkg.pr.new/@heroui/react@5750

@heroui/system

npm i https://pkg.pr.new/@heroui/system@5750

@heroui/system-rsc

npm i https://pkg.pr.new/@heroui/system-rsc@5750

@heroui/theme

npm i https://pkg.pr.new/@heroui/theme@5750

@heroui/use-aria-accordion

npm i https://pkg.pr.new/@heroui/use-aria-accordion@5750

@heroui/use-aria-accordion-item

npm i https://pkg.pr.new/@heroui/use-aria-accordion-item@5750

@heroui/use-aria-button

npm i https://pkg.pr.new/@heroui/use-aria-button@5750

@heroui/use-aria-link

npm i https://pkg.pr.new/@heroui/use-aria-link@5750

@heroui/use-aria-modal-overlay

npm i https://pkg.pr.new/@heroui/use-aria-modal-overlay@5750

@heroui/use-aria-multiselect

npm i https://pkg.pr.new/@heroui/use-aria-multiselect@5750

@heroui/use-aria-overlay

npm i https://pkg.pr.new/@heroui/use-aria-overlay@5750

@heroui/use-callback-ref

npm i https://pkg.pr.new/@heroui/use-callback-ref@5750

@heroui/use-clipboard

npm i https://pkg.pr.new/@heroui/use-clipboard@5750

@heroui/use-data-scroll-overflow

npm i https://pkg.pr.new/@heroui/use-data-scroll-overflow@5750

@heroui/use-disclosure

npm i https://pkg.pr.new/@heroui/use-disclosure@5750

@heroui/use-draggable

npm i https://pkg.pr.new/@heroui/use-draggable@5750

@heroui/use-form-reset

npm i https://pkg.pr.new/@heroui/use-form-reset@5750

@heroui/use-image

npm i https://pkg.pr.new/@heroui/use-image@5750

@heroui/use-infinite-scroll

npm i https://pkg.pr.new/@heroui/use-infinite-scroll@5750

@heroui/use-intersection-observer

npm i https://pkg.pr.new/@heroui/use-intersection-observer@5750

@heroui/use-is-mobile

npm i https://pkg.pr.new/@heroui/use-is-mobile@5750

@heroui/use-is-mounted

npm i https://pkg.pr.new/@heroui/use-is-mounted@5750

@heroui/use-measure

npm i https://pkg.pr.new/@heroui/use-measure@5750

@heroui/use-pagination

npm i https://pkg.pr.new/@heroui/use-pagination@5750

@heroui/use-real-shape

npm i https://pkg.pr.new/@heroui/use-real-shape@5750

@heroui/use-ref-state

npm i https://pkg.pr.new/@heroui/use-ref-state@5750

@heroui/use-resize

npm i https://pkg.pr.new/@heroui/use-resize@5750

@heroui/use-safe-layout-effect

npm i https://pkg.pr.new/@heroui/use-safe-layout-effect@5750

@heroui/use-scroll-position

npm i https://pkg.pr.new/@heroui/use-scroll-position@5750

@heroui/use-ssr

npm i https://pkg.pr.new/@heroui/use-ssr@5750

@heroui/use-theme

npm i https://pkg.pr.new/@heroui/use-theme@5750

@heroui/use-update-effect

npm i https://pkg.pr.new/@heroui/use-update-effect@5750

@heroui/use-viewport-size

npm i https://pkg.pr.new/@heroui/use-viewport-size@5750

@heroui/aria-utils

npm i https://pkg.pr.new/@heroui/aria-utils@5750

@heroui/dom-animation

npm i https://pkg.pr.new/@heroui/dom-animation@5750

@heroui/framer-utils

npm i https://pkg.pr.new/@heroui/framer-utils@5750

@heroui/react-rsc-utils

npm i https://pkg.pr.new/@heroui/react-rsc-utils@5750

@heroui/react-utils

npm i https://pkg.pr.new/@heroui/react-utils@5750

@heroui/shared-icons

npm i https://pkg.pr.new/@heroui/shared-icons@5750

@heroui/shared-utils

npm i https://pkg.pr.new/@heroui/shared-utils@5750

@heroui/stories-utils

npm i https://pkg.pr.new/@heroui/stories-utils@5750

@heroui/test-utils

npm i https://pkg.pr.new/@heroui/test-utils@5750

commit: dc81692

@wingkwong wingkwong merged commit 7b7190e into canary Oct 3, 2025
10 checks passed
@wingkwong wingkwong deleted the fix/eng-2813 branch October 3, 2025 17:10
AnYiEE added a commit to AnYiEE/touhou-mystia-izakaya-assistant that referenced this pull request Oct 6, 2025
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] - Autocomplete Generates Duplicate IDs in HeroUI v2.8.4, Breaking ARIA/Accessibility

1 participant