зеркало из https://github.com/mozilla/gecko-dev.git
Bug 761102 - focus may be missed when ARIA active-descendant is changed on active composite widget, r=tbsaunde, f=davidb
This commit is contained in:
Родитель
33cd6a744c
Коммит
6174d95762
|
@ -2846,7 +2846,21 @@ Accessible::IsWidget() const
|
|||
bool
|
||||
Accessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->IsFocused(this);
|
||||
if (FocusMgr()->HasDOMFocus(mContent))
|
||||
return true;
|
||||
|
||||
// If text entry of combobox widget has a focus then the combobox widget is
|
||||
// active.
|
||||
if (mRoleMapEntry && mRoleMapEntry->Is(nsGkAtoms::combobox)) {
|
||||
PRUint32 childCount = ChildCount();
|
||||
for (PRUint32 idx = 0; idx < childCount; idx++) {
|
||||
Accessible* child = mChildren.ElementAt(idx);
|
||||
if (child->Role() == roles::ENTRY)
|
||||
return FocusMgr()->HasDOMFocus(child->GetContent());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -1221,11 +1221,11 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
|||
void
|
||||
DocAccessible::ARIAActiveDescendantChanged(nsIContent* aElm)
|
||||
{
|
||||
if (FocusMgr()->HasDOMFocus(aElm)) {
|
||||
Accessible* widget = GetAccessible(aElm);
|
||||
if (widget && widget->IsActiveWidget()) {
|
||||
nsAutoString id;
|
||||
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
nsIDocument* DOMDoc = aElm->OwnerDoc();
|
||||
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
|
||||
dom::Element* activeDescendantElm = aElm->OwnerDoc()->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
Accessible* activeDescendant = GetAccessible(activeDescendantElm);
|
||||
if (activeDescendant) {
|
||||
|
|
|
@ -70,6 +70,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
|
|||
|
||||
gQueue.push(new synthFocus("container", new focusChecker("item1")));
|
||||
gQueue.push(new changeARIAActiveDescendant("container", "item2"));
|
||||
|
||||
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("container", "item3"));
|
||||
|
||||
|
@ -87,6 +91,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
|
|||
title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()">
|
||||
Mozilla Bug 429547
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=761102"
|
||||
title="Focus may be missed when ARIA active-descendant is changed on active composite widget">
|
||||
Mozilla Bug 761102
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -96,5 +105,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
|
|||
<div role="listitem" id="item1">item1</div>
|
||||
<div role="listitem" id="item2">item2</div>
|
||||
</div>
|
||||
|
||||
<div role="combobox" id="combobox">
|
||||
<input id="combobox_entry">
|
||||
<ul>
|
||||
<li role="option" id="combobox_option1">option1</li>
|
||||
<li role="option" id="combobox_option2">option2</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче