hotfix: blur ComboBox, MultiSelect focus based on relatedTarget tag name (#540)

* fix(combo-fix): dont re-focus listbox if relatedTarget is input/select/textarea

* fix(combo-box): check if relatedTarget is truthy

* fix(multi-select): dont re-focus listbox if relatedTarget is input/select/textarea
This commit is contained in:
Eric Liu 2021-02-26 14:28:36 -08:00 committed by GitHub
commit d6a136d6ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -316,7 +316,12 @@
}
}}"
on:blur="{({ relatedTarget }) => {
if (relatedTarget && relatedTarget.getAttribute('role') !== 'button') {
if (
relatedTarget &&
!['INPUT', 'SELECT', 'TEXTAREA'].includes(relatedTarget.tagName) &&
relatedTarget.getAttribute('role') !== 'button' &&
relatedTarget.getAttribute('role') !== 'searchbox'
) {
fieldRef.focus();
}
}}"