mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix(composed-modal): perform null check before focusing element
Fixes error in Sapper
This commit is contained in:
parent
add8c1c75a
commit
05932065dc
1 changed files with 2 additions and 2 deletions
|
@ -71,7 +71,7 @@
|
||||||
function focus(element) {
|
function focus(element) {
|
||||||
const node =
|
const node =
|
||||||
(element || innerModal).querySelector(selectorPrimaryFocus) || buttonRef;
|
(element || innerModal).querySelector(selectorPrimaryFocus) || buttonRef;
|
||||||
node.focus();
|
if (node != null) node.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
$: opened = false;
|
$: opened = false;
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
document.body.classList.remove("bx--body--with-modal-open");
|
document.body.classList.remove("bx--body--with-modal-open");
|
||||||
})
|
});
|
||||||
|
|
||||||
afterUpdate(() => {
|
afterUpdate(() => {
|
||||||
if (opened) {
|
if (opened) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue