@fluentui-react-native/focus-zone 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +10 -2
- package/macos/RCTFocusZone.m +38 -22
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@fluentui-react-native/focus-zone",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 26 Jul 2024 15:58:55 GMT",
|
|
6
|
+
"version": "0.19.1",
|
|
7
|
+
"tag": "@fluentui-react-native/focus-zone_v0.19.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "nakambo@microsoft.com",
|
|
12
|
+
"package": "@fluentui-react-native/focus-zone",
|
|
13
|
+
"commit": "434c367e8cac7d3ef78f4827dab146748f3636d6",
|
|
14
|
+
"comment": "[Mac] [Focus Zone] Tweak tab\\shift behavior"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Wed, 24 Jul 2024 16:32:59 GMT",
|
|
6
21
|
"version": "0.19.0",
|
|
7
22
|
"tag": "@fluentui-react-native/focus-zone_v0.19.0",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/focus-zone
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 26 Jul 2024 15:58:55 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.19.1
|
|
8
|
+
|
|
9
|
+
Fri, 26 Jul 2024 15:58:55 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- [Mac] [Focus Zone] Tweak tab\shift behavior (nakambo@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.19.0
|
|
8
16
|
|
|
9
|
-
Wed, 24 Jul 2024 16:
|
|
17
|
+
Wed, 24 Jul 2024 16:32:59 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
package/macos/RCTFocusZone.m
CHANGED
|
@@ -482,8 +482,6 @@ static BOOL ShouldSkipFocusZone(NSView *view)
|
|
|
482
482
|
{
|
|
483
483
|
NSView *nextViewToFocus;
|
|
484
484
|
|
|
485
|
-
[[self window] recalculateKeyViewLoop];
|
|
486
|
-
|
|
487
485
|
// Find the first view outside the FocusZone (or any parent FocusZones) to place focus
|
|
488
486
|
RCTFocusZone *focusZoneAncestor = GetFocusZoneAncestor(self);
|
|
489
487
|
|
|
@@ -527,6 +525,41 @@ static BOOL ShouldSkipFocusZone(NSView *view)
|
|
|
527
525
|
return nextViewToFocus;
|
|
528
526
|
}
|
|
529
527
|
|
|
528
|
+
- (NSView *)nextViewToFocusForTab:(FocusZoneAction)action
|
|
529
|
+
{
|
|
530
|
+
[[self window] recalculateKeyViewLoop];
|
|
531
|
+
|
|
532
|
+
NSString *tabKeyNavigation = [self tabKeyNavigation];
|
|
533
|
+
if (![@"NavigateWrap" isEqual:tabKeyNavigation] && ![@"NavigateStopAtEnds" isEqual:tabKeyNavigation]
|
|
534
|
+
&& ![@"Normal" isEqual:tabKeyNavigation])
|
|
535
|
+
{
|
|
536
|
+
return [self nextViewToFocusOutsideZone:action];
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
BOOL forward = action != FocusZoneActionShiftTab;
|
|
540
|
+
NSView *firstResponder = GetFirstResponder([self window]);
|
|
541
|
+
NSView *nextViewToFocus = action == forward ? [firstResponder nextValidKeyView] : [firstResponder previousValidKeyView];
|
|
542
|
+
|
|
543
|
+
if (nextViewToFocus == self)
|
|
544
|
+
nextViewToFocus = action == forward ? [nextViewToFocus nextValidKeyView] : [nextViewToFocus previousValidKeyView];;
|
|
545
|
+
|
|
546
|
+
if ([@"Normal" isEqual:tabKeyNavigation] || [nextViewToFocus isDescendantOf:self])
|
|
547
|
+
return nextViewToFocus;
|
|
548
|
+
|
|
549
|
+
if ([@"NavigateStopAtEnds" isEqual:tabKeyNavigation])
|
|
550
|
+
return nil;
|
|
551
|
+
|
|
552
|
+
// wrap around -- find first (tab) or last (shift+tab)
|
|
553
|
+
NSView *aView = firstResponder;
|
|
554
|
+
while (aView != self && [aView isDescendantOf:self])
|
|
555
|
+
{
|
|
556
|
+
nextViewToFocus = aView;
|
|
557
|
+
aView = forward ? [aView previousValidKeyView] : [aView nextValidKeyView];
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return nextViewToFocus != firstResponder ? nextViewToFocus : nil;
|
|
561
|
+
}
|
|
562
|
+
|
|
530
563
|
- (BOOL)isFlipped
|
|
531
564
|
{
|
|
532
565
|
return YES;
|
|
@@ -537,11 +570,6 @@ static BOOL ShouldSkipFocusZone(NSView *view)
|
|
|
537
570
|
FocusZoneAction action = GetActionForEvent(event);
|
|
538
571
|
FocusZoneDirection focusZoneDirection = [self focusZoneDirection];
|
|
539
572
|
NSString *navigateAtEnd = [self navigateAtEnd];
|
|
540
|
-
NSString *tabKeyNavigation = [self tabKeyNavigation];
|
|
541
|
-
|
|
542
|
-
BOOL tabAllowed = [@"NavigateWrap" isEqual:tabKeyNavigation]
|
|
543
|
-
|| [@"NavigateStopAtEnds" isEqual:tabKeyNavigation]
|
|
544
|
-
|| [@"Normal" isEqual:tabKeyNavigation];
|
|
545
573
|
|
|
546
574
|
BOOL passthrough = NO;
|
|
547
575
|
NSView *viewToFocus = nil;
|
|
@@ -553,25 +581,13 @@ static BOOL ShouldSkipFocusZone(NSView *view)
|
|
|
553
581
|
{
|
|
554
582
|
passthrough = YES;
|
|
555
583
|
}
|
|
556
|
-
else if (
|
|
584
|
+
else if (action == FocusZoneActionTab || action == FocusZoneActionShiftTab)
|
|
557
585
|
{
|
|
558
|
-
viewToFocus = [self
|
|
586
|
+
viewToFocus = [self nextViewToFocusForTab:action];
|
|
559
587
|
}
|
|
560
588
|
else
|
|
561
589
|
{
|
|
562
|
-
|
|
563
|
-
: (action == FocusZoneActionShiftTab ? FocusZoneActionUpArrow : action);
|
|
564
|
-
|
|
565
|
-
BOOL allowCircular = [@"NavigateWrap" isEqual:action == FocusZoneActionTab || action == FocusZoneActionShiftTab
|
|
566
|
-
? tabKeyNavigation : navigateAtEnd];
|
|
567
|
-
|
|
568
|
-
viewToFocus = [self nextViewToFocusWithFallback:directionalAction considerCircular:allowCircular];
|
|
569
|
-
|
|
570
|
-
if (viewToFocus == nil && action != directionalAction && [@"Normal" isEqual:tabKeyNavigation]) // tab, shift+tab
|
|
571
|
-
{
|
|
572
|
-
// didn't find a view IN the zone -- look outside
|
|
573
|
-
viewToFocus = [self nextViewToFocusOutsideZone:action];
|
|
574
|
-
}
|
|
590
|
+
viewToFocus = [self nextViewToFocusWithFallback:action considerCircular:[@"NavigateWrap" isEqual:navigateAtEnd]];
|
|
575
591
|
}
|
|
576
592
|
|
|
577
593
|
if (viewToFocus != nil)
|
package/package.json
CHANGED