[Mac] [Focus Zone] Restore broken direction = none functionality (#3692)

This commit is contained in:
Navneet Kambo 2024-07-26 23:22:28 -07:00 коммит произвёл GitHub
Родитель dedb5ef0c6
Коммит ee36c6f200
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 18 добавлений и 7 удалений

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

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "[Mac] [Focus Zone] Restore broken direction = none functionality",
"packageName": "@fluentui-react-native/focus-zone",
"email": "nakambo@microsoft.com",
"dependentChangeType": "patch"
}

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

@ -538,10 +538,10 @@ static BOOL ShouldSkipFocusZone(NSView *view)
BOOL forward = action != FocusZoneActionShiftTab;
NSView *firstResponder = GetFirstResponder([self window]);
NSView *nextViewToFocus = action == forward ? [firstResponder nextValidKeyView] : [firstResponder previousValidKeyView];
NSView *nextViewToFocus = forward ? [firstResponder nextValidKeyView] : [firstResponder previousValidKeyView];
if (nextViewToFocus == self)
nextViewToFocus = action == forward ? [nextViewToFocus nextValidKeyView] : [nextViewToFocus previousValidKeyView];;
nextViewToFocus = forward ? [nextViewToFocus nextValidKeyView] : [nextViewToFocus previousValidKeyView];;
if ([@"Normal" isEqual:tabKeyNavigation] || [nextViewToFocus isDescendantOf:self])
return nextViewToFocus;
@ -573,11 +573,7 @@ static BOOL ShouldSkipFocusZone(NSView *view)
BOOL passthrough = NO;
NSView *viewToFocus = nil;
if ([self disabled] || action == FocusZoneActionNone
|| (focusZoneDirection == FocusZoneDirectionVertical
&& (action == FocusZoneActionRightArrow || action == FocusZoneActionLeftArrow))
|| (focusZoneDirection == FocusZoneDirectionHorizontal
&& (action == FocusZoneActionUpArrow || action == FocusZoneActionDownArrow)))
if ([self disabled] || action == FocusZoneActionNone)
{
passthrough = YES;
}
@ -585,6 +581,14 @@ static BOOL ShouldSkipFocusZone(NSView *view)
{
viewToFocus = [self nextViewToFocusForTab:action];
}
else if ((focusZoneDirection == FocusZoneDirectionVertical
&& (action == FocusZoneActionRightArrow || action == FocusZoneActionLeftArrow))
|| (focusZoneDirection == FocusZoneDirectionHorizontal
&& (action == FocusZoneActionUpArrow || action == FocusZoneActionDownArrow))
|| (focusZoneDirection == FocusZoneDirectionNone))
{
passthrough = YES;
}
else
{
viewToFocus = [self nextViewToFocusWithFallback:action considerCircular:[@"NavigateWrap" isEqual:navigateAtEnd]];