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

This commit is contained in:
aaronleventhal%moonset.net 2007-01-31 15:13:39 +00:00
Родитель 140c4bf6ee
Коммит 5e78349a16
2 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

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

Просмотреть файл

@ -240,10 +240,24 @@ nsresult nsRootAccessibleWrap::HandleEventWithTarget(nsIDOMEvent *aEvent,
FireCurrentFocusEvent(); FireCurrentFocusEvent();
} }
else if (eventType.LowerCaseEqualsLiteral("popupshown")) { else if (eventType.LowerCaseEqualsLiteral("popupshown")) {
FireAccessibleFocusEvent(accessible, aTargetNode, aEvent); #ifdef MOZ_XUL
} nsCOMPtr<nsIContent> content(do_QueryInterface(aTargetNode));
else if (eventType.EqualsLiteral("DOMMenuInactive")) { if (content->NodeInfo()->Equals(nsAccessibilityAtoms::tooltip, kNameSpaceID_XUL) ||
//FireAccessibleFocusEvent(accessible, aTargetNode); // Not yet used in ATK 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; return NS_OK;
} }