mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1069574 - [AccessFu] added support for interaction hints in B2G. r=eeejay
--- accessible/jsat/Presentation.jsm | 3 +- accessible/jsat/Utils.jsm | 19 ++++++ accessible/tests/mochitest/jsat/a11y.ini | 1 + accessible/tests/mochitest/jsat/output.js | 13 ++++ accessible/tests/mochitest/jsat/test_hints.html | 85 +++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 accessible/tests/mochitest/jsat/test_hints.html
This commit is contained in:
parent
096edd5eaf
commit
66a07eb506
@ -507,7 +507,8 @@ B2GPresenter.prototype.pivotChanged =
|
||||
pattern: this.PIVOT_CHANGE_HAPTIC_PATTERN,
|
||||
isKey: Utils.isActivatableOnFingerUp(aContext.accessible),
|
||||
reason: this.pivotChangedReasons[aReason],
|
||||
isUserInput: aIsUserInput
|
||||
isUserInput: aIsUserInput,
|
||||
hints: aContext.interactionHints
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -828,6 +828,25 @@ PivotContext.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get interaction hints for the context ancestry.
|
||||
* @return {Array} Array of interaction hints.
|
||||
*/
|
||||
get interactionHints() {
|
||||
let hints = [];
|
||||
this.newAncestry.concat(this.accessible).reverse().forEach(aAccessible => {
|
||||
let hint = Utils.getAttributes(aAccessible)['moz-hint'];
|
||||
if (hint) {
|
||||
hints.push(hint);
|
||||
} else if (aAccessible.actionCount > 0) {
|
||||
hints.push({
|
||||
string: Utils.AccRetrieval.getStringRole(aAccessible.role) + '-hint'
|
||||
});
|
||||
}
|
||||
});
|
||||
return hints;
|
||||
},
|
||||
|
||||
/*
|
||||
* A subtree generator function, used to generate a flattened
|
||||
* list of the accessible's subtree in pre or post order.
|
||||
|
@ -15,6 +15,7 @@ skip-if = buildapp == 'mulet'
|
||||
skip-if = buildapp == 'mulet'
|
||||
[test_explicit_names.html]
|
||||
[test_gesture_tracker.html]
|
||||
[test_hints.html]
|
||||
[test_landmarks.html]
|
||||
[test_live_regions.html]
|
||||
[test_output.html]
|
||||
|
@ -99,3 +99,16 @@ function testOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aOutputKind) {
|
||||
}
|
||||
testObjectOutput(aAccOrElmOrID, generator);
|
||||
}
|
||||
|
||||
function testHints(expected, aAccOrElmOrID, aOldAccOrElmOrID) {
|
||||
var accessible = getAccessible(aAccOrElmOrID);
|
||||
var oldAccessible = aOldAccOrElmOrID !== null ?
|
||||
getAccessible(aOldAccOrElmOrID || 'root') : null;
|
||||
var context = new PivotContext(accessible, oldAccessible);
|
||||
var hints = context.interactionHints;
|
||||
|
||||
isDeeply(hints, expected,
|
||||
"Context hitns are correct for " + aAccOrElmOrID +
|
||||
" (hints: " + JSON.stringify(hints) + ") ==" +
|
||||
" (expected: " + JSON.stringify(expected) + ")");
|
||||
}
|
||||
|
85
accessible/tests/mochitest/jsat/test_hints.html
Normal file
85
accessible/tests/mochitest/jsat/test_hints.html
Normal file
@ -0,0 +1,85 @@
|
||||
<html>
|
||||
<head>
|
||||
<title> [AccessFu] Interaction Hints </title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="output.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest() {
|
||||
var tests = [{
|
||||
accOrElmOrID: 'can_wheel',
|
||||
expectedHints: ['Swipe with two fingers to move between pages']
|
||||
}, {
|
||||
accOrElmOrID: 'nested_link',
|
||||
expectedHints: [{string: 'link-hint'},
|
||||
'Swipe with two fingers to move between pages']
|
||||
}, {
|
||||
accOrElmOrID: 'nested_link',
|
||||
oldAccOrElmOrID: 'can_wheel',
|
||||
expectedHints: [{string: 'link-hint'}]
|
||||
}, {
|
||||
accOrElmOrID: 'link_with_default_hint',
|
||||
expectedHints: [{string: 'link-hint'}]
|
||||
}, {
|
||||
accOrElmOrID: 'link_with_hint_override',
|
||||
expectedHints: ['Tap and hold to get to menu']
|
||||
}, {
|
||||
accOrElmOrID: 'button_with_default_hint',
|
||||
expectedHints: [{string: 'pushbutton-hint'}]
|
||||
}, {
|
||||
accOrElmOrID: 'button_with_hint_override',
|
||||
expectedHints: ['Tap and hold to activate']
|
||||
}, {
|
||||
accOrElmOrID: 'nested_link2',
|
||||
expectedHints: [{string: 'link-hint'}]
|
||||
}, {
|
||||
accOrElmOrID: 'nested_link3',
|
||||
expectedHints: [{string: 'link-hint'}, {string: 'pushbutton-hint'},
|
||||
"Double tap and hold to activate"]
|
||||
}];
|
||||
|
||||
// Test hints.
|
||||
tests.forEach(function run(test) {
|
||||
testHints(test.expectedHints, test.accOrElmOrID, test.oldAccOrElmOrID);
|
||||
});
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1069574"
|
||||
title="[AccessFu] Interaction Hints">
|
||||
Mozilla Bug 1069574
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
<span role="region" id="can_wheel" aria-moz-hint="Swipe with two fingers to move between pages">
|
||||
<a href="#" id="nested_link">I can be clicked</a>
|
||||
</span>
|
||||
<span role="region" aria-moz-hint="">
|
||||
<a><a href="#" id="nested_link2">I can be clicked</a></a>
|
||||
</span>
|
||||
<span role="region" aria-moz-hint="Double tap and hold to activate">
|
||||
<button><a href="#" id="nested_link3">I can be clicked</a></button>
|
||||
</span>
|
||||
<a href="#" id="link_with_default_hint">I can be clicked</a>
|
||||
<a href="#" id="link_with_hint_override" aria-moz-hint="Tap and hold to get to menu">I am a special link</a>
|
||||
<button id="button_with_default_hint">Toggle</button>
|
||||
<button id="button_with_hint_override" aria-moz-hint="Tap and hold to activate">Special</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user