Bug 1841270 - refine focus handling in HidePopover. r=emilio
Only run focusing steps for previouslyFocusedElement if focus is within the popover hierarchy. Differential Revision: https://phabricator.services.mozilla.com/D186439
This commit is contained in:
@@ -3447,10 +3447,13 @@ void nsGenericHTMLElement::FocusPreviousElementAfterHidingPopover() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Run the focusing steps for previouslyFocusedElement
|
||||
FocusOptions options;
|
||||
options.mPreventScroll = true;
|
||||
control->Focus(options, CallerType::NonSystem, IgnoreErrors());
|
||||
// Run the focusing steps for previouslyFocusedElement if focus is within the
|
||||
// popover hierarchy.
|
||||
if (IsShadowIncludingInclusiveDescendantOf(control)) {
|
||||
FocusOptions options;
|
||||
options.mPreventScroll = true;
|
||||
control->Focus(options, CallerType::NonSystem, IgnoreErrors());
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/popover.html#dom-togglepopover
|
||||
|
||||
Reference in New Issue
Block a user