Bug 1950782 part 1: Expose the SELECTABLE_TEXT state on DocAccessibles when appropriate. r=nlapre,devtools-reviewers,nchevobbe
We already had code to expose SELECTABLE_TEXT in HyperTextAccessible, from which DocAccessible inherits. However, DocAccessible overrides the method and doesn't call the HyperTextAccessible implementation. We don't want to do that because it does work that isn't necessary for DocAccessible. In addition, we need to use a different layout frame for the document. See the code comments for details. Specific code has been added to DocAccessible to expose this state. This fixes the UIA Text pattern's SupportedTextSelection property on documents. Differential Revision: https://phabricator.services.mozilla.com/D239854
This commit is contained in:
@@ -863,3 +863,43 @@ addAccessibleTask(
|
||||
},
|
||||
{ chrome: true, topLevel: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test the selectable text state.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`
|
||||
<p id="selectableP">selectableP</p>
|
||||
<p id="unselectableP" style="user-select: none;">unselectableP</p>
|
||||
`,
|
||||
async function testSelectableText(browser, docAcc) {
|
||||
testStates(docAcc, 0, EXT_STATE_SELECTABLE_TEXT);
|
||||
const selectableP = findAccessibleChildByID(docAcc, "selectableP");
|
||||
testStates(selectableP, 0, EXT_STATE_SELECTABLE_TEXT);
|
||||
const unselectableP = findAccessibleChildByID(docAcc, "unselectableP");
|
||||
testStates(unselectableP, 0, 0, 0, EXT_STATE_SELECTABLE_TEXT);
|
||||
},
|
||||
{ chrome: true, topLevel: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test the selectable text state on an unselectable body.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`
|
||||
<style>
|
||||
body {
|
||||
user-select: none;
|
||||
}
|
||||
<p id="p">p</p>
|
||||
`,
|
||||
async function testSelectableTextUnselectableBody(browser, docAcc) {
|
||||
testStates(docAcc, 0, 0, 0, EXT_STATE_SELECTABLE_TEXT);
|
||||
const p = findAccessibleChildByID(docAcc, "p");
|
||||
testStates(p, 0, 0, 0, EXT_STATE_SELECTABLE_TEXT);
|
||||
},
|
||||
{
|
||||
chrome: true,
|
||||
topLevel: true,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1423,6 +1423,23 @@ body {
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test the Text pattern's SupportedTextSelection property on a document with a
|
||||
* selectable body.
|
||||
*/
|
||||
addUiaTask(``, async function testTextSupportedTextSelectionSelectableBody() {
|
||||
is(
|
||||
await runPython(`
|
||||
global doc
|
||||
doc = getDocUia()
|
||||
text = getUiaPattern(doc, "Text")
|
||||
return text.SupportedTextSelection
|
||||
`),
|
||||
SupportedTextSelection_Multiple,
|
||||
"doc SupportedTextSelection correct"
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Test the Text pattern's GetSelection method with the caret.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user