Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAR-1977: Update the focus first directive to wait for animations to stop #808

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2024-10-26 - a7f234223a3a34e55a77e3c216733c9f01e5e3c9 - directives/focus-first-element/index.ts - Update the focus first directive to wait for animations to stop

2024-10-25 - 0ba4cd7666f48d5e702ff930ec39f43f203bc4bc -Input/PasswordInput.vue - Updating password Input field

2024-10-22 - 84b7f4bfe4893a54c8bd281e10feda17a2356abd -Icon/icons.ts - Added new icon as oxd-open-new-tab
Expand Down
6 changes: 4 additions & 2 deletions components/src/directives/focus-first-element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const focusOnFirstElement = (
const firstFocusedElement = element.querySelectorAll(matchingString)[0];
firstFocusedElementsOnMounted.set(vnode.scopeId, firstFocusedElement);
if (firstFocusedElement) {
(firstFocusedElement as HTMLElement).focus({
preventScroll: true,
window.requestAnimationFrame(() => {
(firstFocusedElement as HTMLElement).focus({
preventScroll: true,
});
});
}
};
Expand Down
Loading