@fluentui-react-native/focus-zone 0.18.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 CHANGED
@@ -2,7 +2,37 @@
2
2
  "name": "@fluentui-react-native/focus-zone",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 23 Jul 2024 16:55:40 GMT",
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",
21
+ "version": "0.19.0",
22
+ "tag": "@fluentui-react-native/focus-zone_v0.19.0",
23
+ "comments": {
24
+ "minor": [
25
+ {
26
+ "author": "patboyd@microsoft.com",
27
+ "package": "@fluentui-react-native/focus-zone",
28
+ "commit": "94f1248b7cc169c26b9c685704965a275be6e5d8",
29
+ "comment": "Implementation of FocusZone navigationOrderInRenderOrder for MacOS"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 23 Jul 2024 16:56:54 GMT",
6
36
  "version": "0.18.0",
7
37
  "tag": "@fluentui-react-native/focus-zone_v0.18.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 Tue, 23 Jul 2024 16:55:40 GMT and should not be manually modified.
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
+
15
+ ## 0.19.0
16
+
17
+ Wed, 24 Jul 2024 16:32:59 GMT
18
+
19
+ ### Minor changes
20
+
21
+ - Implementation of FocusZone navigationOrderInRenderOrder for MacOS (patboyd@microsoft.com)
22
+
7
23
  ## 0.18.0
8
24
 
9
- Tue, 23 Jul 2024 16:55:40 GMT
25
+ Tue, 23 Jul 2024 16:56:54 GMT
10
26
 
11
27
  ### Minor changes
12
28
 
@@ -1,11 +1,11 @@
1
1
  import type * as React from 'react';
2
- import type { ViewStyle } from 'react-native';
2
+ import type { IViewProps } from '@fluentui-react-native/adapters';
3
3
  import type { IFocusable } from '@fluentui-react-native/interactive-hooks';
4
4
  import type { IRenderData } from '@uifabricshared/foundation-composable';
5
5
  export declare const focusZoneName = "FocusZone";
6
6
  export interface FocusZoneState {
7
7
  }
8
- export type FocusZoneProps = React.PropsWithChildren<{
8
+ export type FocusZoneProps = IViewProps & {
9
9
  /**
10
10
  * A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
11
11
  */
@@ -53,10 +53,23 @@ export type FocusZoneProps = React.PropsWithChildren<{
53
53
  */
54
54
  onFocus?: (e?: any) => void;
55
55
  /**
56
- * Allow consumers to pass in Style props
56
+ * @platform macos
57
+ * By default, the Apple KeyView loop is calculated based on the UI tree hierarchy, accessibility properties,
58
+ * custom element overrides of navigation order, and positions in layout.
59
+ *
60
+ * Normally this produces the appropriate accessible experience for users, but occasionally we may need to
61
+ * clarify the intended order of navigation. The navigationOrderInRenderOrder prop will have the FocusZone
62
+ * establish the navigation order of its children according to their order in the UI tree
63
+ * (i.e. as returned by accessibilityChildren).
64
+ *
65
+ * Note that to participate in the KeyView loop calculation, the FocusZone itself must be part of the
66
+ * accessibility tree (i.e. 'accessible') with an appropriate role, e.g. 'group'.
67
+ *
68
+ * Extra note: This property is unlikely to perform well if changed from its initial value due to finer details
69
+ * of the MacOS KeyView loop mechanics.
57
70
  */
58
- style?: ViewStyle;
59
- }>;
71
+ navigationOrderInRenderOrder?: boolean;
72
+ };
60
73
  export interface NativeProps extends Omit<FocusZoneProps, 'isCircularNavigation'> {
61
74
  navigateAtEnd?: NavigateAtEnd;
62
75
  tabKeyNavigation?: FocusZoneTabNavigation;
@@ -1 +1 @@
1
- {"version":3,"file":"FocusZone.types.d.ts","sourceRoot":"","sources":["../src/FocusZone.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEzE,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACnD;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAE3C;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAE1D;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAE1C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CA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5B,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,KAAK,EAAE,cAAc,CAAC;CACvB"}
@@ -1,11 +1,11 @@
1
1
  import type * as React from 'react';
2
- import type { ViewStyle } from 'react-native';
2
+ import type { IViewProps } from '@fluentui-react-native/adapters';
3
3
  import type { IFocusable } from '@fluentui-react-native/interactive-hooks';
4
4
  import type { IRenderData } from '@uifabricshared/foundation-composable';
5
5
  export declare const focusZoneName = "FocusZone";
6
6
  export interface FocusZoneState {
7
7
  }
8
- export type FocusZoneProps = React.PropsWithChildren<{
8
+ export type FocusZoneProps = IViewProps & {
9
9
  /**
10
10
  * A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
11
11
  */
@@ -53,10 +53,23 @@ export type FocusZoneProps = React.PropsWithChildren<{
53
53
  */
54
54
  onFocus?: (e?: any) => void;
55
55
  /**
56
- * Allow consumers to pass in Style props
56
+ * @platform macos
57
+ * By default, the Apple KeyView loop is calculated based on the UI tree hierarchy, accessibility properties,
58
+ * custom element overrides of navigation order, and positions in layout.
59
+ *
60
+ * Normally this produces the appropriate accessible experience for users, but occasionally we may need to
61
+ * clarify the intended order of navigation. The navigationOrderInRenderOrder prop will have the FocusZone
62
+ * establish the navigation order of its children according to their order in the UI tree
63
+ * (i.e. as returned by accessibilityChildren).
64
+ *
65
+ * Note that to participate in the KeyView loop calculation, the FocusZone itself must be part of the
66
+ * accessibility tree (i.e. 'accessible') with an appropriate role, e.g. 'group'.
67
+ *
68
+ * Extra note: This property is unlikely to perform well if changed from its initial value due to finer details
69
+ * of the MacOS KeyView loop mechanics.
57
70
  */
58
- style?: ViewStyle;
59
- }>;
71
+ navigationOrderInRenderOrder?: boolean;
72
+ };
60
73
  export interface NativeProps extends Omit<FocusZoneProps, 'isCircularNavigation'> {
61
74
  navigateAtEnd?: NavigateAtEnd;
62
75
  tabKeyNavigation?: FocusZoneTabNavigation;
@@ -1 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ic) BOOL disabled;
16
+ @property(nonatomic) BOOL navigationOrderInRenderOrder;
16
17
  @property(nonatomic) FocusZoneDirection focusZoneDirection;
17
18
  @property(nonatomic) NSString *navigateAtEnd;
18
19
  @property(nonatomic) NSString *tabKeyNavigation;
@@ -186,6 +186,17 @@ static BOOL ShouldSkipFocusZone(NSView *view)
186
186
  return NO;
187
187
  }
188
188
 
189
+ /// FocusZone bases its return to accessibilityChildrenInNavigationOrder on the navigationOrderInRenderOrder property.
190
+ /// If navigationOrderInRenderOrder is set to YES, the accessible children are returned in the same order as returned by [(NSView) accessibilityChildren].
191
+ /// If navigationOrderInRenderOrder is set to NO, the accessible children are returned in the order determined by [(NSView) accessibilityChildrenInNavigationOrder].
192
+ - (NSArray *)accessibilityChildrenInNavigationOrder {
193
+ if ([self navigationOrderInRenderOrder]) {
194
+ return [self accessibilityChildren];
195
+ }
196
+
197
+ return [super accessibilityChildrenInNavigationOrder];
198
+ }
199
+
189
200
  /// Accept firstResponder on FocusZone itself in order to reassign it within the FocusZone.
190
201
  - (BOOL)acceptsFirstResponder
191
202
  {
@@ -471,8 +482,6 @@ static BOOL ShouldSkipFocusZone(NSView *view)
471
482
  {
472
483
  NSView *nextViewToFocus;
473
484
 
474
- [[self window] recalculateKeyViewLoop];
475
-
476
485
  // Find the first view outside the FocusZone (or any parent FocusZones) to place focus
477
486
  RCTFocusZone *focusZoneAncestor = GetFocusZoneAncestor(self);
478
487
 
@@ -516,6 +525,41 @@ static BOOL ShouldSkipFocusZone(NSView *view)
516
525
  return nextViewToFocus;
517
526
  }
518
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
+
519
563
  - (BOOL)isFlipped
520
564
  {
521
565
  return YES;
@@ -526,11 +570,6 @@ static BOOL ShouldSkipFocusZone(NSView *view)
526
570
  FocusZoneAction action = GetActionForEvent(event);
527
571
  FocusZoneDirection focusZoneDirection = [self focusZoneDirection];
528
572
  NSString *navigateAtEnd = [self navigateAtEnd];
529
- NSString *tabKeyNavigation = [self tabKeyNavigation];
530
-
531
- BOOL tabAllowed = [@"NavigateWrap" isEqual:tabKeyNavigation]
532
- || [@"NavigateStopAtEnds" isEqual:tabKeyNavigation]
533
- || [@"Normal" isEqual:tabKeyNavigation];
534
573
 
535
574
  BOOL passthrough = NO;
536
575
  NSView *viewToFocus = nil;
@@ -542,25 +581,13 @@ static BOOL ShouldSkipFocusZone(NSView *view)
542
581
  {
543
582
  passthrough = YES;
544
583
  }
545
- else if (!tabAllowed && (action == FocusZoneActionTab || action == FocusZoneActionShiftTab))
584
+ else if (action == FocusZoneActionTab || action == FocusZoneActionShiftTab)
546
585
  {
547
- viewToFocus = [self nextViewToFocusOutsideZone:action];
586
+ viewToFocus = [self nextViewToFocusForTab:action];
548
587
  }
549
588
  else
550
589
  {
551
- FocusZoneAction directionalAction = action == FocusZoneActionTab ? FocusZoneActionDownArrow
552
- : (action == FocusZoneActionShiftTab ? FocusZoneActionUpArrow : action);
553
-
554
- BOOL allowCircular = [@"NavigateWrap" isEqual:action == FocusZoneActionTab || action == FocusZoneActionShiftTab
555
- ? tabKeyNavigation : navigateAtEnd];
556
-
557
- viewToFocus = [self nextViewToFocusWithFallback:directionalAction considerCircular:allowCircular];
558
-
559
- if (viewToFocus == nil && action != directionalAction && [@"Normal" isEqual:tabKeyNavigation]) // tab, shift+tab
560
- {
561
- // didn't find a view IN the zone -- look outside
562
- viewToFocus = [self nextViewToFocusOutsideZone:action];
563
- }
590
+ viewToFocus = [self nextViewToFocusWithFallback:action considerCircular:[@"NavigateWrap" isEqual:navigateAtEnd]];
564
591
  }
565
592
 
566
593
  if (viewToFocus != nil)
@@ -9,6 +9,12 @@ RCT_EXPORT_MODULE()
9
9
 
10
10
  RCT_EXPORT_VIEW_PROPERTY(disabled, BOOL)
11
11
 
12
+ RCT_CUSTOM_VIEW_PROPERTY(navigationOrderInRenderOrder, BOOL, RCTFocusZone)
13
+ {
14
+ [view setNavigationOrderInRenderOrder:[json boolValue]];
15
+ [[view window] recalculateKeyViewLoop];
16
+ }
17
+
12
18
  RCT_CUSTOM_VIEW_PROPERTY(focusZoneDirection, NSString, RCTFocusZone)
13
19
  {
14
20
  if ([json isEqualToString:@"bidirectional"])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/focus-zone",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
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",
@@ -22,6 +22,7 @@
22
22
  "directory": "packages/components/FocusZone"
23
23
  },
24
24
  "dependencies": {
25
+ "@fluentui-react-native/adapters": "0.13.0",
25
26
  "@fluentui-react-native/interactive-hooks": "0.27.0",
26
27
  "@uifabricshared/foundation-composable": "0.13.0",
27
28
  "@uifabricshared/foundation-settings": "0.15.0"
@@ -1,6 +1,6 @@
1
1
  import type * as React from 'react';
2
- import type { ViewStyle } from 'react-native';
3
2
 
3
+ import type { IViewProps } from '@fluentui-react-native/adapters';
4
4
  import type { IFocusable } from '@fluentui-react-native/interactive-hooks';
5
5
  import type { IRenderData } from '@uifabricshared/foundation-composable';
6
6
 
@@ -8,7 +8,7 @@ export const focusZoneName = 'FocusZone';
8
8
 
9
9
  export interface FocusZoneState {}
10
10
 
11
- export type FocusZoneProps = React.PropsWithChildren<{
11
+ export type FocusZoneProps = IViewProps & {
12
12
  /**
13
13
  * A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
14
14
  */
@@ -65,10 +65,23 @@ export type FocusZoneProps = React.PropsWithChildren<{
65
65
  onFocus?: (e?: any) => void;
66
66
 
67
67
  /**
68
- * Allow consumers to pass in Style props
68
+ * @platform macos
69
+ * By default, the Apple KeyView loop is calculated based on the UI tree hierarchy, accessibility properties,
70
+ * custom element overrides of navigation order, and positions in layout.
71
+ *
72
+ * Normally this produces the appropriate accessible experience for users, but occasionally we may need to
73
+ * clarify the intended order of navigation. The navigationOrderInRenderOrder prop will have the FocusZone
74
+ * establish the navigation order of its children according to their order in the UI tree
75
+ * (i.e. as returned by accessibilityChildren).
76
+ *
77
+ * Note that to participate in the KeyView loop calculation, the FocusZone itself must be part of the
78
+ * accessibility tree (i.e. 'accessible') with an appropriate role, e.g. 'group'.
79
+ *
80
+ * Extra note: This property is unlikely to perform well if changed from its initial value due to finer details
81
+ * of the MacOS KeyView loop mechanics.
69
82
  */
70
- style?: ViewStyle;
71
- }>;
83
+ navigationOrderInRenderOrder?: boolean;
84
+ };
72
85
 
73
86
  export interface NativeProps extends Omit<FocusZoneProps, 'isCircularNavigation'> {
74
87
  navigateAtEnd?: NavigateAtEnd;