Skip to content

Commit

Permalink
Modal: add extra focus element check (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvuerings committed Mar 25, 2024
1 parent 4be0373 commit f9aa886
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-melons-yell.md
@@ -0,0 +1,5 @@
---
"@cambly/syntax-core": minor
---

Modal: add extra focus element check
4 changes: 2 additions & 2 deletions packages/syntax-core/src/Modal/FocusTrap.tsx
Expand Up @@ -22,8 +22,8 @@ function queryFocusableAll(el: HTMLDivElement): NodeListOf<HTMLElement> {
return el.querySelectorAll(selector);
}

const focusElement = (el: HTMLElement) => {
if (typeof el.focus === "function") {
const focusElement = (el?: HTMLElement) => {
if (el && typeof el.focus === "function") {
el.focus();
}
};
Expand Down

0 comments on commit f9aa886

Please sign in to comment.