зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1911518 - Don't use mozTextAccessible on container comboboxes. r=Jamie
This still does not resolve ARIA 1.0 styled boxes where the entry aria-owns the list. Differential Revision: https://phabricator.services.mozilla.com/D218983
This commit is contained in:
Родитель
9d004a5638
Коммит
cb942059a2
|
@ -123,6 +123,10 @@ Class AccessibleWrap::GetNativeType() {
|
|||
return [MOXOuterDoc class];
|
||||
}
|
||||
|
||||
if (IsTextField()) {
|
||||
return [mozTextAccessible class];
|
||||
}
|
||||
|
||||
return GetTypeFromRole(Role());
|
||||
|
||||
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
|
||||
|
@ -214,10 +218,7 @@ Class a11y::GetTypeFromRole(roles::Role aRole) {
|
|||
return [mozTabGroupAccessible class];
|
||||
|
||||
case roles::ENTRY:
|
||||
case roles::CAPTION:
|
||||
case roles::EDITCOMBOBOX:
|
||||
case roles::PASSWORD_TEXT:
|
||||
// normal textfield (static or editable)
|
||||
return [mozTextAccessible class];
|
||||
|
||||
case roles::TEXT_LEAF:
|
||||
|
|
|
@ -68,6 +68,8 @@ void ProxyCreated(RemoteAccessible* aProxy) {
|
|||
type = [MOXWebAreaAccessible class];
|
||||
} else if (aProxy->IsOuterDoc()) {
|
||||
type = [MOXOuterDoc class];
|
||||
} else if (aProxy->IsTextField()) {
|
||||
type = [mozTextAccessible class];
|
||||
} else {
|
||||
type = GetTypeFromRole(aProxy->Role());
|
||||
}
|
||||
|
|
|
@ -123,6 +123,10 @@ using namespace mozilla::a11y;
|
|||
if (state == states::BUSY) {
|
||||
[self moxPostNotification:@"AXElementBusyChanged"];
|
||||
}
|
||||
|
||||
if (state == states::EXPANDED) {
|
||||
[self moxPostNotification:@"AXExpandedChanged"];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)providesLabelNotTitle {
|
||||
|
|
|
@ -106,7 +106,7 @@ inline NSString* ToNSString(id aValue) {
|
|||
}
|
||||
|
||||
- (NSString*)moxRole {
|
||||
if ([self stateWithMask:states::MULTI_LINE]) {
|
||||
if (mRole == roles::ENTRY && [self stateWithMask:states::MULTI_LINE]) {
|
||||
return NSAccessibilityTextAreaRole;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ https_first_disabled = true
|
|||
|
||||
["browser_bounds.js"]
|
||||
|
||||
["browser_combobox.js"]
|
||||
|
||||
["browser_details_summary.js"]
|
||||
|
||||
["browser_focus.js"]
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
async function testComboBox(browser, accDoc, suppressPopupInValueTodo = false) {
|
||||
const box = getNativeInterface(accDoc, "box");
|
||||
is(box.getAttributeValue("AXRole"), "AXComboBox");
|
||||
is(box.getAttributeValue("AXValue"), "peach", "Initial value correct");
|
||||
|
||||
let expandedChanged = waitForMacEvent("AXExpandedChanged", "box");
|
||||
let didBoxValueChange = false;
|
||||
waitForMacEvent("AXValueChanged", "box").then(() => {
|
||||
didBoxValueChange = true;
|
||||
});
|
||||
await invokeContentTask(browser, [], () => {
|
||||
const b = content.document.getElementById("box");
|
||||
b.ariaExpanded = true;
|
||||
});
|
||||
|
||||
await expandedChanged;
|
||||
if (suppressPopupInValueTodo) {
|
||||
todo(
|
||||
!didBoxValueChange,
|
||||
"Value of combobox did not change when it was opened"
|
||||
);
|
||||
todo_is(box.getAttributeValue("AXValue"), "peach");
|
||||
} else {
|
||||
ok(
|
||||
!didBoxValueChange,
|
||||
"Value of combobox did not change when it was opened"
|
||||
);
|
||||
is(box.getAttributeValue("AXValue"), "peach", "After popup value correct");
|
||||
}
|
||||
}
|
||||
|
||||
addAccessibleTask(
|
||||
`
|
||||
<style>
|
||||
#box[aria-expanded=false] > ul {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<div role="combobox" id="box" aria-expanded="false" aria-haspopup="listbox">
|
||||
<input id="input" value="peach" aria-autocomplete="list" aria-controls="controlled_listbox">
|
||||
<ul role="listbox" id="controlled_listbox">
|
||||
<li role="option">apple</li>
|
||||
<li role="option">peach</li>
|
||||
</ul>
|
||||
</div>`,
|
||||
async (browser, accDoc) => {
|
||||
info("Test ARIA 1.1 style combobox (role on container of entry and list)");
|
||||
await testComboBox(browser, accDoc);
|
||||
}
|
||||
);
|
||||
|
||||
addAccessibleTask(
|
||||
`
|
||||
<style>
|
||||
#box[aria-expanded=false] + ul {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<input type="text" id="box" role="combobox" value="peach"
|
||||
aria-owns="owned_listbox"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="listbox"
|
||||
aria-autocomplete="list" >
|
||||
<ul role="listbox" id="owned_listbox">
|
||||
<li role="option">apple</li>
|
||||
<li role="option">peach</li>
|
||||
</ul>
|
||||
`,
|
||||
async (browser, accDoc) => {
|
||||
info("Test ARIA 1.0 style combobox (entry aria-owns list)");
|
||||
// XXX: Bug 1912520
|
||||
await testComboBox(browser, accDoc, true);
|
||||
}
|
||||
);
|
||||
|
||||
addAccessibleTask(
|
||||
`
|
||||
<style>
|
||||
#box[aria-expanded=false] + ul {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<input type="text" id="box" role="combobox" value="peach"
|
||||
aria-controls="controlled_listbox"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="listbox"
|
||||
aria-autocomplete="list" >
|
||||
<ul role="listbox" id="controlled_listbox">
|
||||
<li role="option">apple</li>
|
||||
<li role="option">peach</li>
|
||||
</ul>
|
||||
`,
|
||||
async (browser, accDoc) => {
|
||||
info("Test ARIA 1.2 style combobox (entry aria-controls list)");
|
||||
await testComboBox(browser, accDoc);
|
||||
}
|
||||
);
|
Загрузка…
Ссылка в новой задаче