fix(InputMenu/SelectMenu): prevent unintended item creation and improve focus handling#5986
Conversation
📝 WalkthroughWalkthroughAdds internal combobox root refs and post-flush watches in InputMenu.vue and SelectMenu.vue to call Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 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)
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: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/runtime/components/SelectMenu.vue`:
- Around line 487-492: The onInputEnter handler currently calls onCreate(e)
whenever there is no highlighted element regardless of whether creation is
enabled; update onInputEnter to first check props.createItem (or an equivalent
create-enabled flag) and only call onCreate(e) when props.createItem is truthy
and comboboxRootRef.value?.highlightedElement is falsy, so pressing Enter won’t
emit a create event when create is disabled; refer to the onInputEnter function,
the onCreate handler, and props.createItem to implement this guard.
…ndle focus and items properly
|
Just realised there was still a not intuitive situation, when focus was in the input-tag, and user moved the focus out of the Let me know if there is any need for change. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/runtime/components/InputMenu.vue`:
- Around line 503-516: The onInputEnter function currently calls onCreate
unconditionally when there are no items; update it to guard against unwanted
creation by checking the creation flag (e.g., props.createItem or whichever prop
enables creation) before invoking onCreate. In onInputEnter, after the existing
combobox focus and items checks, add a conditional that ensures props.createItem
is truthy (or the appropriate creation-enabled prop) and only then call
onCreate(e); otherwise do nothing (or return). This change should reference
onInputEnter, onCreate, comboboxRootRef, and props.items to locate and fix the
behavior.
…putMenu` and `SelectMenu`
InputMenu and SelectMenu (#5974)
🔗 Linked issue
Resolves #5974
❓ Type of change
📚 Description
Based on the issues described in #5974, following fixes were applied:
TagsInputInputpreventing calling default Reka behaviour, which triggers an internalonAddValue, which isn't connected in any way to Nuxt UIitemsprop, and in filters are ignored and creation is enabled, trigger to select first item in the dropdown.📝 Checklist
I don't think there is a need to write anything to documentation?