ubuntu.com
ubuntu.com copied to clipboard
Clearing search field annoyingly defocuses it
- Focus the search field in the navigation bar.
- Type some text.
- Click the clear button.
- Start typing some different text.
What should happen: The text you type appears in the search field.
What actually happens: The text is lost, because the search field is no longer focused.
According to vanilla-framework#2866 this won’t be fixed in Vanilla, so it needs to be fixed for each search field individually. It may be possible to copy the code used to fix it in the vanillaframework.io/docs search field.
Reported from: https://ubuntu.com/
@bartaz do you think this could be a vanilla issue?
I can't replicate this. I have cleared the site search and the search pattern example and both refocus on the input after clearing.
I guess on ubuntu.com this issue predates the new expanding search that you can't clear, because "clear" button closes it (which could be considered issue itself).
This particular one was JS issue. Native behaviour of reset button resets the whole form, to keep focus in search field JS needs to do it explicitly. In past it didn't. It is fixed in Vanilla examples, but likely was never updated in projects.
History lesson aside - this particular issue can be closed I think because expanding search in the navigation changes the behaviour and there is no reset button anymore.
Search has changed now, this no longer seems to be an issue.