Skip to content

Commit

Permalink
Add conditional focus behavior to search field after filter selection
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerdema committed Dec 4, 2023
1 parent df59704 commit a703e5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions admin/app/components/solidus_admin/ui/table/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ export default class extends Controller {
}
}

showSearch(event) {
showSearch({ detail: { focus } }) {
this.modeValue = "search"
this.render()
this.searchFieldTarget.focus()

if (focus ?? true) {
this.searchFieldTarget.focus()
}
}

search() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ export default class extends Controller {
}

showSearch() {
if (this.isAnyCheckboxChecked())
this.dispatch("showSearch")
if (this.isAnyCheckboxChecked()) {
this.dispatch("showSearch", { detail: { focus: false } })
}
}

filterOptions(event) {
Expand Down

0 comments on commit a703e5e

Please sign in to comment.