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 @@
Phone status bar
-
+
diff --git a/accessible/tests/mochitest/jsat/test_content_integration.html b/accessible/tests/mochitest/jsat/test_content_integration.html index 40e52bba88ab..30ff22a23be8 100644 --- a/accessible/tests/mochitest/jsat/test_content_integration.html +++ b/accessible/tests/mochitest/jsat/test_content_integration.html @@ -179,16 +179,15 @@ [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], // Open dialog in outer doc, while cursor is also in outer doc - [ContentMessages.simpleMoveNext, - new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])], + [ContentMessages.simpleMoveLast, + new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], [doc.defaultView.showAlert, new ExpectedCursorChange(['This is an alert!', {'string': 'headingLevel', 'args': [1]}, {'string': 'dialog'}])], [doc.defaultView.hideAlert, - new ExpectedCursorChange(["wow", - {"string": "headingLevel", "args": [1]}, "such app"])], + new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], @@ -204,8 +203,12 @@ {'string': 'headingLevel', 'args': [1]}, {'string': 'dialog'}])], - // XXX: Place cursor back where it was. - [doc.defaultView.hideAlert, + [ContentMessages.simpleMoveNext, + new ExpectedCursorChange(['Do you agree?'])], + [ContentMessages.simpleMoveNext, + new ExpectedCursorChange(['Yes', {'string': 'pushbutton'}])], + [ContentMessages.activateCurrent(), + new ExpectedClickAction(), new ExpectedCursorChange( ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],