mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(overlays): focus is not moved if active element is in overlay (#25481)
resolves #24127, resolves #24820 Co-authored-by: MarkChrisLevy <MarkChrisLevy@users.noreply.github.com>
This commit is contained in:
@ -430,7 +430,13 @@ export const present = async (
|
||||
focusPreviousElementOnDismiss(overlay.el);
|
||||
}
|
||||
|
||||
if (overlay.keyboardClose) {
|
||||
/**
|
||||
* If the focused element is already
|
||||
* inside the overlay component then
|
||||
* focus should not be moved from that
|
||||
* to the overlay container.
|
||||
*/
|
||||
if (overlay.keyboardClose && (document.activeElement === null || !overlay.el.contains(document.activeElement))) {
|
||||
overlay.el.focus();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user