зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1620318 - Filter out hidden popup menus and announce them when they appear. r=morgan
As the message above suggests this does two things: 1. We filter out the invisible popup menus from the root's children. 2. We dispatch menu opened and closed events. The latter helps VoiceOver retain some context about the mutating tree and notify the user about the menu. Differential Revision: https://phabricator.services.mozilla.com/D65612 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9690c5105b
Коммит
d18ab374a8
|
@ -102,7 +102,9 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
|
|||
eventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE &&
|
||||
eventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
|
||||
eventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED &&
|
||||
eventType != nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE)
|
||||
eventType != nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE &&
|
||||
eventType != nsIAccessibleEvent::EVENT_MENUPOPUP_START &&
|
||||
eventType != nsIAccessibleEvent::EVENT_MENUPOPUP_END)
|
||||
return NS_OK;
|
||||
|
||||
Accessible* accessible = aEvent->GetAccessible();
|
||||
|
@ -180,6 +182,12 @@ void a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType) {
|
|||
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
|
||||
[aNativeAcc documentLoadComplete];
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
|
||||
[aNativeAcc menuOpened];
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
|
||||
[aNativeAcc menuClosed];
|
||||
break;
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
|
|
|
@ -124,6 +124,8 @@ static const uintptr_t IS_PROXY = 1;
|
|||
- (void)valueDidChange;
|
||||
- (void)selectedTextDidChange;
|
||||
- (void)documentLoadComplete;
|
||||
- (void)menuOpened;
|
||||
- (void)menuClosed;
|
||||
|
||||
// internal method to retrieve a child at a given index.
|
||||
- (id)childAt:(uint32_t)i;
|
||||
|
|
|
@ -1016,6 +1016,16 @@ struct RoleDescrComparator {
|
|||
NSAccessibilityPostNotification(realSelf, @"AXLayoutComplete");
|
||||
}
|
||||
|
||||
- (void)menuOpened {
|
||||
id realSelf = GetObjectOrRepresentedView(self);
|
||||
NSAccessibilityPostNotification(realSelf, @"AXMenuOpened");
|
||||
}
|
||||
|
||||
- (void)menuClosed {
|
||||
id realSelf = GetObjectOrRepresentedView(self);
|
||||
NSAccessibilityPostNotification(realSelf, @"AXMenuClosed");
|
||||
}
|
||||
|
||||
- (NSString*)help {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
|
|
|
@ -77,6 +77,27 @@ static id<mozAccessible, mozView> getNativeViewFromRootAccessible(Accessible* aA
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (NSArray*)children {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
return [[super children]
|
||||
filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(mozAccessible* child,
|
||||
NSDictionary* bindings) {
|
||||
AccessibleWrap* childAcc = [child getGeckoAccessible];
|
||||
if (childAcc && childAcc->Role() == roles::MENUPOPUP &&
|
||||
((childAcc->VisibilityState() & states::INVISIBLE) != 0)) {
|
||||
// Filter out all invisible XUL popup menus. Invisible elements in our browser
|
||||
// chrome are unique in the sense that we want screen readers to ignore them.
|
||||
// These only exist in the top level process so we don't do a similar check on proxies.
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}]];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
// this will return our parallell NSView. see mozDocAccessible.h
|
||||
- (id)representedView {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче