Bug 687011 - aria-activedescendant change on inserted node doesn't fire focus change, r=jamie

This commit is contained in:
Alexander Surkov 2018-06-08 10:55:08 -04:00
parent ae2cc7ca99
commit 94ab51d46c
3 changed files with 21 additions and 5 deletions

View file

@ -259,6 +259,18 @@ public:
ScheduleProcessing();
}
template<class Class, class Arg>
inline void ScheduleNotification(Class* aInstance,
typename TNotification<Class, Arg>::Callback aMethod,
Arg* aArg)
{
RefPtr<Notification> notification =
new TNotification<Class, Arg>(aInstance, aMethod, aArg);
if (notification && mNotifications.AppendElement(notification)) {
ScheduleProcessing();
}
}
#ifdef DEBUG
bool IsUpdating() const
{ return mObservingState == eRefreshProcessingForUpdate; }

View file

@ -959,11 +959,13 @@ DocAccessible::ARIAAttributeChanged(Accessible* aAccessible, nsAtom* aAttribute)
// The activedescendant universal property redirects accessible focus events
// to the element with the id that activedescendant points to. Make sure
// the tree up to date before processing.
// the tree up to date before processing. In other words, when a node has just
// been inserted, the tree won't be up to date yet, so we must always schedule
// an async notification so that a newly inserted node will be present in
// the tree.
if (aAttribute == nsGkAtoms::aria_activedescendant) {
mNotificationController->HandleNotification<DocAccessible, Accessible>
mNotificationController->ScheduleNotification<DocAccessible, Accessible>
(this, &DocAccessible::ARIAActiveDescendantChanged, aAccessible);
return;
}

View file

@ -44,8 +44,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
this.invoke = function insertItemNFocus_invoke() {
var container = getNode(aID);
var itemNode = document.createElement("div");
itemNode.setAttribute("id", aNewItemID);
itemNode.setAttribute("role", "listitem");
itemNode.textContent = aNewItemID;
container.appendChild(itemNode);
@ -68,8 +70,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
gQueue.push(new synthFocus("combobox_entry", new focusChecker("combobox_entry")));
gQueue.push(new changeARIAActiveDescendant("combobox", "combobox_option2"));
todo(false, "No focus for inserted element, bug 687011");
// gQueue.push(new insertItemNFocus("listbox", "item4"));
gQueue.push(new synthFocus("listbox", new focusChecker("item3")));
gQueue.push(new insertItemNFocus("listbox", "item4"));
gQueue.invoke(); // Will call SimpleTest.finish();
}