Skip to content
Open
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/Dom/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ export function lockFocus(element: HTMLElement, id: string): VoidFunction {
// Just add event since it will de-duplicate
window.addEventListener('focusin', syncFocus);
window.addEventListener('keydown', onWindowKeyDown, true);
// If the element is not focused, focus it
// https://github.com/ant-design/ant-design/issues/56963
if (!hasFocus(element)) {
element.focus({ preventScroll: true });
}
Comment thread
luozz1994 marked this conversation as resolved.
Outdated
syncFocus();
}

Expand Down