Skip to content

Commit

Permalink
Bug 1594337: When dismissing a pop-up or the menu bar, if focus is in…
Browse files Browse the repository at this point in the history
…side an OOP iframe, restore a11y focus inside the iframe. r=yzen

Previously, we only restored focus within the top level remote browser.
This is fine for remote documents without iframes or only in-process iframes, as was the case with e10s.
For Fission, if an OOP iframe has focus, we need to get the appropriate nested remote browser.
Fortunately, BrowserParent::GetFocused was introduced to do exactly this.

Differential Revision: https://phabricator.services.mozilla.com/D52803

--HG--
extra : moz-landing-system : lando
  • Loading branch information
jcsteh committed Nov 13, 2019
1 parent d33d08e commit f6c5c02
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions accessible/base/FocusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,15 @@ void FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive) {
}
mActiveItem = aItem;

// If mActiveItem is null we may need to shift a11y focus back to a tab
// If mActiveItem is null we may need to shift a11y focus back to a remote
// document. For example, when combobox popup is closed, then
// the focus should be moved back to the combobox.
if (!mActiveItem && XRE_IsParentProcess()) {
nsFocusManager* domfm = nsFocusManager::GetFocusManager();
if (domfm) {
nsIContent* focusedElm = domfm->GetFocusedElement();
if (EventStateManager::IsRemoteTarget(focusedElm)) {
dom::BrowserParent* tab = dom::BrowserParent::GetFrom(focusedElm);
if (tab) {
a11y::DocAccessibleParent* dap = tab->GetTopLevelDocAccessible();
if (dap) {
Unused << dap->SendRestoreFocus();
}
}
dom::BrowserParent* browser = dom::BrowserParent::GetFocused();
if (browser) {
a11y::DocAccessibleParent* dap = browser->GetTopLevelDocAccessible();
if (dap) {
Unused << dap->SendRestoreFocus();
}
}
}
Expand Down

0 comments on commit f6c5c02

Please sign in to comment.