Repository navigation
Conversation
…o deps The `v-memo` on `ListboxItem` only listed `[isHighlighted, isSelected]`, but the cached VNode also reads `disabled` (for both the `disabled` and `data-disabled` attributes) and `rootContext.focusable.value` (for the `tabindex` ternary). Because `v-memo` skips re-render when none of its listed deps change, toggling `disabled` at runtime left the DOM stale until something else also flipped the highlight or selection. Since `Listbox.getCollectionItem()` filters the navigable collection by reading `dataset.disabled` from the live DOM, the stale attribute caused disabled items to keep participating in keyboard navigation — which in Combobox surfaced as ArrowDown "snapping back" to the originally selected item. Closes #2644
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes a bug in ChangesListboxItem disabled memo fix and test
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: lockfile failed supply-chain policy check. Run 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. Comment |
commit: |
Summary
disabledandrootContext.focusable.valueto thev-memodependency list onListboxItem's renderedPrimitive.:disabledreactively without touching highlight/selection and asserts the DOM attributes update.Problem
ListboxItemcached its VNode withv-memo="[isHighlighted, isSelected]", but the cached expression also readsdisabled(for thedisabledanddata-disabledattributes) androotContext.focusable.value(for thetabindexternary).v-memoskips re-render when none of the listed deps change, so flipping:disabledat runtime leftdata-disabled/disabledstale on the DOM until something also changed the highlight or selection for that item.Because
Listbox.getCollectionItem()filters the navigable collection by readingdataset.disabled !== ''from the live DOM, a stale attribute kept disabled items in the keyboard-navigable set. In<ComboboxRoot>with a dynamic item set, this surfaced as "every other ArrowDown jumps back to the originally selected item" (issue reporter's downstream symptom in NuxtUIInputMenu).Fix
This is the only
v-memousage inpackages/core/src(grepped), so the scope is limited to this single file.Test plan
Listbox.test.tstogglesdisabledreactively and assertsdata-disabled/disabledare reflected on the DOM both ways — confirmed red before the fix, green after.pnpm vitest run src/Listbox/Listbox.test.ts).Fixes #2644
Summary by CodeRabbit
Bug Fixes
Tests
#2644to verify disabled state behavior in Listbox items.