Bug 1598026 - only reset panel state on document-ready event of the top level document. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D78595
This commit is contained in:
Yura Zenevich 2020-06-12 17:32:35 +00:00
parent af845d619c
commit 30512f1f1c
2 changed files with 20 additions and 2 deletions

View File

@ -100,7 +100,7 @@ class MainFrame extends Component {
"can-be-disabled-change": this.onCanBeDisabledChange,
});
this.props.startListeningForAccessibilityEvents({
"document-ready": this.resetAccessibility,
"top-level-document-ready": this.resetAccessibility,
});
window.addEventListener("resize", this.onPanelWindowResize, true);
}
@ -115,7 +115,7 @@ class MainFrame extends Component {
"can-be-disabled-change": this.onCanBeDisabledChange,
});
this.props.stopListeningForAccessibilityEvents({
"document-ready": this.resetAccessibility,
"top-level-document-ready": this.resetAccessibility,
});
window.removeEventListener("resize", this.onPanelWindowResize, true);
}

View File

@ -268,10 +268,28 @@ class AccessibleFront extends FrontClassWithSpec(accessibleSpec) {
}
class AccessibleWalkerFront extends FrontClassWithSpec(accessibleWalkerSpec) {
constructor(client, targetFront, parentFront) {
super(client, targetFront, parentFront);
this.documentReady = this.documentReady.bind(this);
this.on("document-ready", this.documentReady);
}
destroy() {
this.off("document-ready", this.documentReady);
super.destroy();
}
form(json) {
this.actorID = json.actor;
}
documentReady() {
if (this.targetFront.isTopLevel) {
this.emit("top-level-document-ready");
}
}
pick(doFocus) {
if (doFocus) {
return this.pickAndFocus();