CRUD
CRUD copied to clipboard
[Feature Request] Filters inputs doesn't focus when opening the filter
Feature Request
What's the feature you think Backpack should have?
When user open a filters, the focus is not on the input field, so user cannot start entering keys, but must click once again to gain focus
Have you already implemented a prototype solution, for your own project?
We added 'globally' in an app.js a small fix for select 2
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});
Enough for our specific case but NOT covering text input fields.
Do you see this as a core feature or an add-on?
it should be a core feature
Hello @realtebo
Thanks for the suggestion.
I think this already work on fields, you can check it on demo ( https://demo.backpackforlaravel.com ) that when the select2 opens the search is focused so you can start typing right way.

But I am afraid it does not work the same way in select2 Filters from my tests.
I will be switching this to issue instead of Feature Request and assign @jorgetwgroup to have a look at it as he already worked on this select2 focus issues previously.
Cheers
Please, do not focus only on select2. this is easily fixable by ourselves.
Fixit for textual inputs
So that becomes a Feature and not a fix, cause until now NONE of the filters open the inputs.
I also think that this lies somewhat in a "fix" for UX/UI so I will keep this in This Week for @jorgetwgroup to have a look when he got time for it.
If it does not require massive changes we could fit this in the "fixing" pipeline for UI/UX stuff and be done with it, otherwise we will move this as a Feature Request to have a look in the next version.
Thanks again @realtebo
Jumping in. This is also something that bothered me, multiple times. I kind of agree with you Pedro that it's "a feature"... but I "kind of" agree with @realtebo too that it's a bug. After all... it doesn't behave in the expected way. And unfortunately @pxpm we DO have a filter that focuses on the input select2_multiple. So... not only is it non-intuitive... it's inconsistent... 😔 So let's call it what it is... a bug 😀
This is a small problem, but I want us to get it done in this version. These small things add up to a better UX and show how much we care.
To sum up, here are all the filter types and what we should do with each:
- [x] Simple - nothing to do
- [ ] Text - TODO: focus on input
- [ ] Date - TODO: focus on input (will also open picker which is great)
- [ ] Date range - TODO: focus on input (will also open picker which is great)
- [x] Dropdown - nothing to do
- [ ] Select2 - TODO: focus on input (so the user can start typing)
- [x] Select2_multiple - nothing to do, already focuses on input
- [ ] Select2_ajax - TODO: focus on input (so the user can start typing)
- [ ] Range - TODO: focus on first input
- [x] View - nothing to do
Added the PR in the PRO. https://github.com/Laravel-Backpack/PRO/pull/101
Is waiting review and should probably be merged by next Monday.
Will be closing this, thanks @realtebo for pointing that out 🙏