Skip to content

Commit

Permalink
fix related click target
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Aug 19, 2024
1 parent 1230239 commit 39ae972
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ class Autocomplete {
}

onblur(e) {
const related = e.relatedTarget;
// Clicking on the scroll in a modal blur the element incorrectly
if (this._isMouse && e.relatedTarget && e.relatedTarget.classList.contains("modal")) {
// Set focus back in
// In chrome >= 127, the related target is the dropdown menu
if (this._isMouse && related && (related.classList.contains("modal") || related.classList.contains("autocomplete-menu"))) {
// Restore focus
this._searchInput.focus();
return;
}
Expand Down

0 comments on commit 39ae972

Please sign in to comment.