Skip to content

Commit

Permalink
Set focus before transition
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurClemens committed Aug 17, 2024
1 parent 8835c85 commit bfd2e1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ const showView = async (
options.willShow?.(elements);
options.getStatus?.(prompt.status);

focusFirstElement(content, isFocusFirst, focusFirstSelector);

const duration = getDuration(content);
await wait(duration);

focusFirstElement(content, isFocusFirst, focusFirstSelector);

prompt.status = {
...INITIAL_STATUS,
didShow: true,
Expand Down
1 change: 0 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export const getFirstFocusable = (content: HTMLElement) => {
) as HTMLElement[]
)
// Omit focus trap element
.filter(el => !(el.getAttribute('aria-hidden') === 'true'))
.filter(el => isFocusable(el, true))
.sort((a, b) => a.tabIndex - b.tabIndex);
return focusable[0] || content;
Expand Down

0 comments on commit bfd2e1c

Please sign in to comment.