diff --git a/accessible/src/jsat/ContentControl.jsm b/accessible/src/jsat/ContentControl.jsm
index 950ebc8a3a87..28018d1b924f 100644
--- a/accessible/src/jsat/ContentControl.jsm
+++ b/accessible/src/jsat/ContentControl.jsm
@@ -221,9 +221,26 @@ this.ContentControl.prototype = {
return;
}
+ // recursively find a descendant that is activatable.
+ let getActivatableDescendant = (aAccessible) => {
+ if (aAccessible.actionCount > 0) {
+ return aAccessible;
+ }
+
+ for (let acc = aAccessible.firstChild; acc; acc = acc.nextSibling) {
+ let activatable = getActivatableDescendant(acc);
+ if (activatable) {
+ return activatable;
+ }
+ }
+
+ return null;
+ };
+
let vc = this.vc;
if (!this.sendToChild(vc, aMessage)) {
- activateAccessible(vc.position);
+ let position = vc.position;
+ activateAccessible(getActivatableDescendant(position) || position);
}
},
diff --git a/accessible/src/jsat/TraversalRules.jsm b/accessible/src/jsat/TraversalRules.jsm
index 95cca9b3e93a..48791e1aa037 100644
--- a/accessible/src/jsat/TraversalRules.jsm
+++ b/accessible/src/jsat/TraversalRules.jsm
@@ -113,7 +113,7 @@ var gSimpleMatchFunc = function gSimpleMatchFunc(aAccessible) {
function isFlatSubtree(acc) {
for (let child = acc.firstChild; child; child = child.nextSibling) {
- if (child.childCount > 0) {
+ if (child.childCount > 0 || child.actionCount > 0) {
return false;
}
}
diff --git a/accessible/tests/mochitest/jsat/doc_content_integration.html b/accessible/tests/mochitest/jsat/doc_content_integration.html
index a7d18c9841dc..feef05cf2abc 100644
--- a/accessible/tests/mochitest/jsat/doc_content_integration.html
+++ b/accessible/tests/mochitest/jsat/doc_content_integration.html
@@ -8,7 +8,9 @@
'
such app' +
'' +
'wow
' +
- '
' +
+ '' +
'' +
'' +
'' +
diff --git a/accessible/tests/mochitest/jsat/doc_traversal.html b/accessible/tests/mochitest/jsat/doc_traversal.html
index 4e1ed1fa3b92..31d83e95eca2 100644
--- a/accessible/tests/mochitest/jsat/doc_traversal.html
+++ b/accessible/tests/mochitest/jsat/doc_traversal.html
@@ -37,7 +37,7 @@
-
+