mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1833079: When notified about a dom::ElementState::INVALID change, let AccStateChangeEvent calculate whether the state is enabled. r=morgan
Previously, we passed true for aIsEnabled, indicating that the state was only ever enabled, never disabled. We could get the actual enabled value here using dom::ElementState::HasState(), but that wouldn't take aria-invalid into account if present. Instead, we let AccStateChangeEvent calculate it by calling Accessible::State(). Differential Revision: https://phabricator.services.mozilla.com/D178039
This commit is contained in:
parent
8671fdb578
commit
6c26a79a58
@ -987,7 +987,7 @@ void DocAccessible::ElementStateChanged(dom::Document* aDocument,
|
||||
|
||||
if (aStateMask.HasState(dom::ElementState::INVALID)) {
|
||||
RefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(accessible, states::INVALID, true);
|
||||
new AccStateChangeEvent(accessible, states::INVALID);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
|
@ -452,3 +452,33 @@ addAccessibleTask(
|
||||
},
|
||||
{ topLevel: true, iframe: true, remoteIframe: true, chrome: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test invalid state determined via DOM.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<input type="email" id="email">`,
|
||||
async function(browser, docAcc) {
|
||||
const email = findAccessibleChildByID(docAcc, "email");
|
||||
info("Focusing email");
|
||||
let focused = waitForEvent(EVENT_FOCUS, email);
|
||||
email.takeFocus();
|
||||
await focused;
|
||||
info("Typing a");
|
||||
let invalidChanged = waitForStateChange(email, STATE_INVALID, true);
|
||||
EventUtils.sendString("a");
|
||||
await invalidChanged;
|
||||
testStates(email, STATE_INVALID);
|
||||
info("Typing @b");
|
||||
invalidChanged = waitForStateChange(email, STATE_INVALID, false);
|
||||
EventUtils.sendString("@b");
|
||||
await invalidChanged;
|
||||
testStates(email, 0, 0, STATE_INVALID);
|
||||
info("Typing backspace");
|
||||
invalidChanged = waitForStateChange(email, STATE_INVALID, true);
|
||||
EventUtils.synthesizeKey("KEY_Backspace");
|
||||
await invalidChanged;
|
||||
testStates(email, STATE_INVALID);
|
||||
},
|
||||
{ chrome: true, topLevel: true, remoteIframe: true }
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user