@fluentui-react-native/focus-zone 0.19.0 → 0.19.2

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 CHANGED
@@ -2,7 +2,37 @@
2
2
  "name": "@fluentui-react-native/focus-zone",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 24 Jul 2024 16:31:50 GMT",
5
+ "date": "Sat, 27 Jul 2024 06:53:01 GMT",
6
+ "version": "0.19.2",
7
+ "tag": "@fluentui-react-native/focus-zone_v0.19.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "nakambo@microsoft.com",
12
+ "package": "@fluentui-react-native/focus-zone",
13
+ "commit": "ee36c6f2003fa16ebfca7394ab86ea754d4c37ee",
14
+ "comment": "[Mac] [Focus Zone] Restore broken direction = none functionality"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Fri, 26 Jul 2024 16:00:07 GMT",
21
+ "version": "0.19.1",
22
+ "tag": "@fluentui-react-native/focus-zone_v0.19.1",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "nakambo@microsoft.com",
27
+ "package": "@fluentui-react-native/focus-zone",
28
+ "commit": "434c367e8cac7d3ef78f4827dab146748f3636d6",
29
+ "comment": "[Mac] [Focus Zone] Tweak tab\\shift behavior"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Wed, 24 Jul 2024 16:32:59 GMT",
6
36
  "version": "0.19.0",
7
37
  "tag": "@fluentui-react-native/focus-zone_v0.19.0",
8
38
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @fluentui-react-native/focus-zone
2
2
 
3
- This log was last generated on Wed, 24 Jul 2024 16:31:50 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 27 Jul 2024 06:53:01 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.19.2
8
+
9
+ Sat, 27 Jul 2024 06:53:01 GMT
10
+
11
+ ### Patches
12
+
13
+ - [Mac] [Focus Zone] Restore broken direction = none functionality (nakambo@microsoft.com)
14
+
15
+ ## 0.19.1
16
+
17
+ Fri, 26 Jul 2024 16:00:07 GMT
18
+
19
+ ### Patches
20
+
21
+ - [Mac] [Focus Zone] Tweak tab\shift behavior (nakambo@microsoft.com)
22
+
7
23
  ## 0.19.0
8
24
 
9
- Wed, 24 Jul 2024 16:31:50 GMT
25
+ Wed, 24 Jul 2024 16:32:59 GMT
10
26
 
11
27
  ### Minor changes
12
28
 
@@ -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 = forward ? [firstResponder nextValidKeyView] : [firstResponder previousValidKeyView];
542
+
543
+ if (nextViewToFocus == self)
544
+ nextViewToFocus = 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,41 +570,28 @@ 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;
548
- if ([self disabled] || action == FocusZoneActionNone
549
- || (focusZoneDirection == FocusZoneDirectionVertical
550
- && (action == FocusZoneActionRightArrow || action == FocusZoneActionLeftArrow))
551
- || (focusZoneDirection == FocusZoneDirectionHorizontal
552
- && (action == FocusZoneActionUpArrow || action == FocusZoneActionDownArrow)))
576
+ if ([self disabled] || action == FocusZoneActionNone)
553
577
  {
554
578
  passthrough = YES;
555
579
  }
556
- else if (!tabAllowed && (action == FocusZoneActionTab || action == FocusZoneActionShiftTab))
580
+ else if (action == FocusZoneActionTab || action == FocusZoneActionShiftTab)
581
+ {
582
+ viewToFocus = [self nextViewToFocusForTab:action];
583
+ }
584
+ else if ((focusZoneDirection == FocusZoneDirectionVertical
585
+ && (action == FocusZoneActionRightArrow || action == FocusZoneActionLeftArrow))
586
+ || (focusZoneDirection == FocusZoneDirectionHorizontal
587
+ && (action == FocusZoneActionUpArrow || action == FocusZoneActionDownArrow))
588
+ || (focusZoneDirection == FocusZoneDirectionNone))
557
589
  {
558
- viewToFocus = [self nextViewToFocusOutsideZone:action];
590
+ passthrough = YES;
559
591
  }
560
592
  else
561
593
  {
562
- FocusZoneAction directionalAction = action == FocusZoneActionTab ? FocusZoneActionDownArrow
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
- }
594
+ viewToFocus = [self nextViewToFocusWithFallback:action considerCircular:[@"NavigateWrap" isEqual:navigateAtEnd]];
575
595
  }
576
596
 
577
597
  if (viewToFocus != nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/focus-zone",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "description": "A cross-platform FocusZone component using the Fluent Design System",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",