-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchBox input should receive focus after clearing #775
Comments
I'm not sure if this is possible, but it might be nice if this only restored the focus to the input if the input had focus when the clear button was clicked. This might be better for MAAS and JAAS-dashboard where the clear button is more of a "clear current filters" action that can done somewhat independently of typing searches. This might be especially true for the search and filter pattern used in JAAS (and soon to be used in MAAS) where focusing on the search input opens up a panel. |
This is possible, but I'm not sure it's a good idea - if you're using keyboard instead of mouse, the input field will never be focused while you press the clear button. |
Even if you are using a mouse I think as soon as you click focus will move to the button. |
It seems it may have to be an optional prop? Because in cases when it is a purely text search box, you probably want to focus it after clearing. But if it is a search&filter pattern which has more interactive functionality on focus, clearing likely means "get rid of everything and close the dropdown" - so we don't want to focus back. So |
Good idea, updated the PR and added |
…ring-#775 feat: focus SearchBox input after clearing #775
Related to canonical/maas.io#463
Steps to reproduce
What actually happens
Any text you start entering will be lost, because the search field is no longer focused.
What should happen
The text you enter appears in the search field because it's automatically focused.
The text was updated successfully, but these errors were encountered: