Fixed autocomplete bug by enclosing div within a form tag #380#616
Fixed autocomplete bug by enclosing div within a form tag #380#616aaryan-gautam wants to merge 2 commits into
Conversation
bwindels
left a comment
There was a problem hiding this comment.
Thanks for your PR, I have left some comments
| } | ||
| )); | ||
| const utilitiesRow = t.div({className: "utilities"}, [ | ||
| const utilitiesRow = t.form({name:"utilities-form"}, [ |
There was a problem hiding this comment.
won't this submit the form now when you hit enter on the filter field?
| @@ -1,12 +1,9 @@ | |||
| /* | |||
| Copyright 2020 Bruno Windels <bruno@windels.cloud> | |||
|
|
|||
There was a problem hiding this comment.
Please don't introduce any unrelated white space changes
| } | ||
| )); | ||
| const utilitiesRow = t.div({className: "utilities"}, [ | ||
| const utilitiesRow = t.form({name:"utilities-form"}, [ |
There was a problem hiding this comment.
probably only the filter field should be in the form, not the button links?
There was a problem hiding this comment.
const utilitiesRow = t.form({ name: "utilities-form", onSubmit: (event) => { event.preventDefault(); // Prevent form submission // Additional code logic if needed }, }, [ // Form elements ]);
By adding the onSubmit event listener to the form element and calling event.preventDefault(), you can prevent the form from submitting when the enter key is pressed within the filter field or any other input field inside the form.
For issue #380, I have inserted a
<form>that is wrapped around the<div>as it is needed for the autocomplete as given at MDN so theutilitiesRowvariable now returns this<form>.I have assigned a name attribute of
utilities-formto the<form>.Resolves #380
Signed-off-by: Aaryan Gautam aaryanyo123@gmail.com