Bug 365690. Don't fire focus events for autocomplete menus while editing a text field (XUL or HTML). r=ginn.chen

git-svn-id: svn://10.0.0.236/trunk@219255 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronleventhal%moonset.net
2007-01-31 15:13:39 +00:00
parent 230605e344
commit 9f084b2c4f
2 changed files with 20 additions and 4 deletions

View File

@@ -490,6 +490,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
} break;
case nsIAccessibleEvent::EVENT_SHOW:
case nsIAccessibleEvent::EVENT_MENUPOPUPSTART:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SHOW\n"));
atk_object_notify_state_change(accWrap->GetAtkObject(),
ATK_STATE_VISIBLE, PR_TRUE);
@@ -499,6 +500,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
break;
case nsIAccessibleEvent::EVENT_HIDE:
case nsIAccessibleEvent::EVENT_MENUPOPUPEND:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_HIDE\n"));
atk_object_notify_state_change(accWrap->GetAtkObject(),
ATK_STATE_VISIBLE, PR_FALSE);

View File

@@ -240,10 +240,24 @@ nsresult nsRootAccessibleWrap::HandleEventWithTarget(nsIDOMEvent *aEvent,
FireCurrentFocusEvent();
}
else if (eventType.LowerCaseEqualsLiteral("popupshown")) {
FireAccessibleFocusEvent(accessible, aTargetNode, aEvent);
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
//FireAccessibleFocusEvent(accessible, aTargetNode); // Not yet used in ATK
#ifdef MOZ_XUL
nsCOMPtr<nsIContent> content(do_QueryInterface(aTargetNode));
if (content->NodeInfo()->Equals(nsAccessibilityAtoms::tooltip, kNameSpaceID_XUL) ||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
NS_LITERAL_STRING("autocomplete"), eIgnoreCase)) {
// 1) Don't fire focus events for tooltips, that wouldn't make any sense.
// 2) Don't fire focus events for autocomplete popups, because they come up
// automatically while the user is typing, and setting focus there would
// interrupt the user.
// ------------------------------------------------------------------------
// If the AT wants to know about these popups it can track the ATK state change
// event we fire for ATK_STATE_INVISIBLE on the popup.
// This is fired as a result of the nsIAccessibleEvent::EVENT_MENUPOPUPSTART
// we fire in the nsRootAccessible event handling for all popups.
return NS_OK;
}
#endif
FireAccessibleFocusEvent(accessible, aTargetNode, aEvent);
}
return NS_OK;
}