Skip to content

Commit

Permalink
fix(modal): activate focus trap reliably at start of transition
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyzerner committed Oct 12, 2023
1 parent 66e0ca1 commit 5036a4f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modal/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ export default class ModalElement extends HTMLElement {

private async wasOpened() {
this.hidden = false;
await hello(this);

this.focusTrap?.activate();
hello(this);

requestAnimationFrame(() => this.focusTrap?.activate());

this.dispatchEvent(new Event('open'));
}
Expand Down

0 comments on commit 5036a4f

Please sign in to comment.