Skip to content

Commit

Permalink
fix(modal): fall back to default focus strategy if there is no autofo…
Browse files Browse the repository at this point in the history
…cus element
  • Loading branch information
tobyzerner committed Nov 6, 2023
1 parent 5036a4f commit fe57357
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modal/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export default class ModalElement extends HTMLElement {
escapeDeactivates: false,
allowOutsideClick: true,
preventScroll: true,
initialFocus: () => this.querySelector<HTMLElement>('[autofocus]'),
initialFocus: () =>
this.querySelector<HTMLElement>('[autofocus]') || undefined,
});
}

Expand Down

0 comments on commit fe57357

Please sign in to comment.