Commit ba59b5a
committed
Update single select search behaviour
This change brings a behaviour similar to the one
that common HTML selects have, on top of some of
TomSelect niceties.
By default, TomSelect would include a search input
in single select mode, even when there is an option
selected, which is uncommon. So instead, we keep
search box visible only when there is nothing
selected. As soon as user selects an option, select
box gains "opacity-0" and therefore hides the
confusing search box effects (caret and ability to
type ahead). However, since a usual HTML select
responds to user's typing by highlighting matched
option (if any), we can replicate this logic because
technically the input is not gone, and it still
responds to user input. If user types while the
select is focused, the options will be filtered and
highlight will be applied (TomSelect defaults),
however if filter search returns 0 options - we
reset the search term to empty string and options
displayed to show full list again.1 parent 1513722 commit ba59b5a
File tree
2 files changed
+10
-0
lines changed- admin/app
- components/solidus_admin/ui/forms/select
- javascript/solidus_admin/web_components
2 files changed
+10
-0
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
0 commit comments