feat(ComposedModal): allow using null for selectorPrimaryFocus to disable auto focus

This commit is contained in:
weaseldotro 2020-11-09 11:14:56 +02:00 committed by GitHub
commit b754e0cf79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,6 +69,9 @@
}); });
function focus(element) { function focus(element) {
if(selectorPrimaryFocus === null) {
return
}
const node = const node =
(element || innerModal).querySelector(selectorPrimaryFocus) || buttonRef; (element || innerModal).querySelector(selectorPrimaryFocus) || buttonRef;
if (node != null) node.focus(); if (node != null) node.focus();