You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using the use:menu system in a form I noticed that if I clicked enter in the input it would open the menu also in the form.
Steps To Reproduce
Create a form with an input and a menu in it
Input type is type="search"
Click enter in the input and it should do on:submit. It should also open the menu (but I assume it shouldn't)
Anything else?
A hacky work around is the following on the input; on:keydown={key => {if(key.key === "Enter") {key.preventDefault(); onSubmit();}}}
When the Enter key is pressed in the input it'll prevent default which creates some on submit event which the use:menu is triggered by (I assume). We then call whatever function you would've defined in the form's on:submit
The text was updated successfully, but these errors were encountered:
Hey @jamess-ais I've now had a moment to understand the issue here. This is actually working as intended. The ARIA APG sets the guidelines for what keyboard shortcuts should be implemented per each element. See the following for menus.
NOTE: we link to this at the top of the Menus doc for future reference.
By changing or removing this behavior we would actually be damaging accessibility for this feature. For now I'd say your work around is probably the best solution if you wish to keep things setup as is.
Alternatively, a better solution might be to avoid using Menu + Inputs in this manner. Note we do have an Auto-complete feature in the works that may be a proper replacement for you soon, but this is not yet available.
Current Behavior
While using the use:menu system in a form I noticed that if I clicked enter in the input it would open the menu also in the form.
Steps To Reproduce
type="search"
on:submit
. It should also open the menu (but I assume it shouldn't)Anything else?
A hacky work around is the following on the input;
on:keydown={key => {if(key.key === "Enter") {key.preventDefault(); onSubmit();}}}
When the Enter key is pressed in the input it'll prevent default which creates some on submit event which the use:menu is triggered by (I assume). We then call whatever function you would've defined in the form's
on:submit
The text was updated successfully, but these errors were encountered: