diff --git a/accessible/jsat/EventManager.jsm b/accessible/jsat/EventManager.jsm index b074469c7407..9bf6e9fc0ce7 100644 --- a/accessible/jsat/EventManager.jsm +++ b/accessible/jsat/EventManager.jsm @@ -61,6 +61,7 @@ this.EventManager.prototype = { this.addEventListener('wheel', this, true); this.addEventListener('scroll', this, true); this.addEventListener('resize', this, true); + this._preDialogPosition = new WeakMap(); } this.present(Presentation.tabStateChanged(null, 'newtab')); @@ -78,6 +79,7 @@ this.EventManager.prototype = { Logger.debug('EventManager.stop'); AccessibilityEventObserver.removeListener(this); try { + this._preDialogPosition.clear(); this.webProgress.removeProgressListener(this); this.removeEventListener('wheel', this, true); this.removeEventListener('scroll', this, true); @@ -272,8 +274,8 @@ this.EventManager.prototype = { // positioned inside it. break; } - this.contentControl.autoMove( - aEvent.accessible, { delay: 500 }); + this._preDialogPosition.set(aEvent.accessible.DOMNode, position); + this.contentControl.autoMove(aEvent.accessible, { delay: 500 }); break; } case Events.VALUE_CHANGE: @@ -366,7 +368,8 @@ this.EventManager.prototype = { if (vc.position && (Utils.getState(vc.position).contains(States.DEFUNCT) || Utils.isInSubtree(vc.position, acc))) { - let position = aEvent.targetPrevSibling || aEvent.targetParent; + let position = this._preDialogPosition.get(aEvent.accessible.DOMNode) || + aEvent.targetPrevSibling || aEvent.targetParent; if (!position) { try { position = acc.previousSibling; diff --git a/accessible/tests/mochitest/jsat/doc_content_integration.html b/accessible/tests/mochitest/jsat/doc_content_integration.html index a59b6f8f4f93..842e8605e387 100644 --- a/accessible/tests/mochitest/jsat/doc_content_integration.html +++ b/accessible/tests/mochitest/jsat/doc_content_integration.html @@ -75,13 +75,13 @@
Do you agree?
- +