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 @@ - + LeLisp
  • JavaScript
  • diff --git a/accessible/tests/mochitest/jsat/test_content_integration.html b/accessible/tests/mochitest/jsat/test_content_integration.html index 64832503f2d1..350bba13e7ce 100644 --- a/accessible/tests/mochitest/jsat/test_content_integration.html +++ b/accessible/tests/mochitest/jsat/test_content_integration.html @@ -36,7 +36,7 @@ speak: 'wow heading level 1 such app' }], [ContentMessages.simpleMoveNext, { - speak: 'many option not checked check button' + speak: 'many option not checked check button First item list 1 item' }], // check checkbox [ContentMessages.activateCurrent(), { @@ -64,7 +64,7 @@ speak: 'much range label' }], [ContentMessages.simpleMovePrevious, { - speak: 'many option checked check button' + speak: 'many option checked check button First item list 1 item' }], // uncheck checkbox [ContentMessages.activateCurrent(), { @@ -99,7 +99,7 @@ speak: 'wow heading level 1 such app' }], [ContentMessages.simpleMoveNext, { - speak: 'many option not checked check button' + speak: 'many option not checked check button First item list 1 item' }], [ContentMessages.simpleMoveFirst, { speak: 'Phone status bar', diff --git a/accessible/tests/mochitest/jsat/test_traversal.html b/accessible/tests/mochitest/jsat/test_traversal.html index fd6f6b9abeb0..a225f7911901 100644 --- a/accessible/tests/mochitest/jsat/test_traversal.html +++ b/accessible/tests/mochitest/jsat/test_traversal.html @@ -56,7 +56,7 @@ 'select-1-1', 'select-1-2', 'checkbox-1-2', 'select-1-3', 'input-1-5', 'button-1-3', 'button-2-1', 'button-2-2', 'button-2-3', - 'button-2-4']); + 'button-2-4', 'checkbox-1-5']); queueTraversalSequence(gQueue, docAcc, TraversalRules.Button, null, ['button-1-1', 'button-1-2', 'button-1-3', @@ -67,7 +67,7 @@ ['radio-1-1', 'radio-1-2']); queueTraversalSequence(gQueue, docAcc, TraversalRules.Checkbox, null, - ['checkbox-1-1', 'checkbox-1-2']); + ['checkbox-1-1', 'checkbox-1-2', 'checkbox-1-5']); queueTraversalSequence(gQueue, docAcc, TraversalRules.Combobox, null, ['select-1-1', 'select-1-2', 'select-1-3']); @@ -78,13 +78,14 @@ queueTraversalSequence(gQueue, docAcc, TraversalRules.ListItem, null, ['listitem-1-1', 'listitem-2-1', 'listitem-2-2', 'listitem-3-1', 'listitem-3-2', 'listitem-3-3', + 'listitem-3-4', 'listitem-3-5', 'listitem-3-6', 'listitem-2-3']); queueTraversalSequence(gQueue, docAcc, TraversalRules.Graphic, null, ['image-2', 'image-3']); queueTraversalSequence(gQueue, docAcc, TraversalRules.Link, null, - ['link-1', 'link-2', 'link-3']); + ['link-0', 'link-1', 'link-2', 'link-3']); queueTraversalSequence(gQueue, docAcc, TraversalRules.Anchor, null, ['anchor-1', 'anchor-2']); @@ -112,7 +113,9 @@ 'formidable warriors, for its unrelenting strict' + ' power is unfathomable.', '• Lists of Programming Languages', 'Lisp ', - '1. Scheme', '2. Racket', '3. Clojure', '• JavaScript', 'heading-5', + '1. Scheme', '2. Racket', '3. Clojure', + '4. Standard Lisp', 'link-0', ' Lisp', 'checkbox-1-5', + ' LeLisp', '• JavaScript', 'heading-5', 'image-2', 'image-3', 'Not actually an image', 'link-1', 'anchor-1', 'link-2', 'anchor-2', 'link-3', '3', '1', '4', '1', 'Just an innocuous separator',