Repository navigation
fix(TagsInput): keep disabled tags out of keyboard removal index - #2786
Merged
zernonia merged 1 commit intoJul 23, 2026
Merged
Conversation
Keyboard delete computed the removal index from the disabled-filtered collection but `handleRemoveTag` applied it to the full model, so with a disabled item present the wrong tag was removed — e.g. a disabled tag placed before removable ones would be deleted instead of the selected tag, and pressing Backspace with only disabled tags left could still remove one. Resolve the selected tag to its index in `modelValue` by value (mirroring `TagsInputItemDelete`), and make `handleRemoveTag` emit the value that was actually removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
📝 WalkthroughWalkthroughTagsInputRoot now resolves keyboard deletion against ChangesTagsInput disabled removal
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
JoMarchant
marked this pull request as draft
July 10, 2026 20:43
JoMarchant
marked this pull request as ready for review
July 10, 2026 20:46
Member
|
LGTM! Thanks @JoMarchant ! |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2785
Description
TagsInputremoved the wrong tag on keyboard delete when adisabledTagsInputItemwas present.The keyboard handler computes the selected tag's index against a disabled-filtered collection:
…but
handleRemoveTagapplied that index to the full model:Since
getItems()already excludes disabled items, the filtered index doesn't match the model index whenever a disabled item exists. Symptoms:TagsInputItemDeletewas unaffected because it already resolves the model index by value (modelValue.findIndex(isEqual(...))).Fix
modelValueby value (viaohash'sisEqual, mirroringTagsInputItemDelete) before removing.handleRemoveTagemit the value that was actually removed (modelValue[index]) instead of indexing the disabled-filtered collection — this also fixes an incorrectremoveTagpayload from the delete button when disabled items are present.Navigation still uses the disabled-filtered collection, so disabled items remain unreachable/unselectable.
Repro (before this PR)
Focus the input → Backspace (selects
user@gmail.com) → Backspace again.admin@acme.com(disabled) is removed.user@gmail.comis removed. ✅Tests
Added a colocated test fixture (
story/_TagsInputDisabled.vue) and cases inTagsInput.test.ts:All
TagsInputtests pass;type-checkand lint are green.