Skip to content
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

[Admin] Add Stock Items index component #5532

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add conditional focus behavior to search field after filter selection
  • Loading branch information
rainerdema committed Dec 5, 2023
commit 357d17f0bc9cfc8be538ba7462fc25b3482c34bf
5 changes: 3 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,11 @@ export default class extends Controller {
}
}

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

if (!avoidFocus) 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: { avoidFocus: true } })
}
}

filterOptions(event) {
Expand Down