@fluentui-react-native/focus-zone 0.9.13 → 0.9.16

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,52 @@
2
2
  "name": "@fluentui-react-native/focus-zone",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 31 Mar 2022 07:25:44 GMT",
5
+ "date": "Fri, 08 Apr 2022 18:52:44 GMT",
6
+ "tag": "@fluentui-react-native/focus-zone_v0.9.16",
7
+ "version": "0.9.16",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "amchiu@microsoft.com",
12
+ "package": "@fluentui-react-native/focus-zone",
13
+ "commit": "15d60684291bc64a6d104448587804bbcfbbb1e4",
14
+ "comment": "Handle FocusZone edge cases"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 06 Apr 2022 22:58:22 GMT",
21
+ "tag": "@fluentui-react-native/focus-zone_v0.9.15",
22
+ "version": "0.9.15",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "beachball",
27
+ "package": "@fluentui-react-native/focus-zone",
28
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.14.8",
29
+ "commit": "bcd4ac6dc74295095a0564905024ef32d6450cff"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 05 Apr 2022 20:05:50 GMT",
36
+ "tag": "@fluentui-react-native/focus-zone_v0.9.14",
37
+ "version": "0.9.14",
38
+ "comments": {
39
+ "patch": [
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui-react-native/focus-zone",
43
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.14.7",
44
+ "commit": "c183b7eb02925bf1d1284ad1b3c80c0f2e0c442f"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Thu, 31 Mar 2022 07:27:47 GMT",
6
51
  "tag": "@fluentui-react-native/focus-zone_v0.9.13",
7
52
  "version": "0.9.13",
8
53
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,36 @@
1
1
  # Change Log - @fluentui-react-native/focus-zone
2
2
 
3
- This log was last generated on Thu, 31 Mar 2022 07:25:44 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 08 Apr 2022 18:52:44 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.9.16
8
+
9
+ Fri, 08 Apr 2022 18:52:44 GMT
10
+
11
+ ### Patches
12
+
13
+ - Handle FocusZone edge cases (amchiu@microsoft.com)
14
+
15
+ ## 0.9.15
16
+
17
+ Wed, 06 Apr 2022 22:58:22 GMT
18
+
19
+ ### Patches
20
+
21
+ - Bump @fluentui-react-native/interactive-hooks to v0.14.8
22
+
23
+ ## 0.9.14
24
+
25
+ Tue, 05 Apr 2022 20:05:50 GMT
26
+
27
+ ### Patches
28
+
29
+ - Bump @fluentui-react-native/interactive-hooks to v0.14.7
30
+
7
31
  ## 0.9.13
8
32
 
9
- Thu, 31 Mar 2022 07:25:44 GMT
33
+ Thu, 31 Mar 2022 07:27:47 GMT
10
34
 
11
35
  ### Patches
12
36
 
@@ -49,6 +49,11 @@ static inline CGFloat GetMinDistanceBetweenRectVerticesAndPoint(NSRect rect, NSP
49
49
  /// This function does not take into account the geometric position of the view.
50
50
  static NSView *GetFirstKeyViewWithin(NSView *parentView)
51
51
  {
52
+ if ([[parentView subviews] count] < 1)
53
+ {
54
+ return nil;
55
+ }
56
+
52
57
  for (NSView *view in [parentView subviews]) {
53
58
  if ([view canBecomeKeyView]) {
54
59
  return view;
@@ -157,10 +162,26 @@ static RCTFocusZone *GetFocusZoneAncestor(NSView *view)
157
162
  return nil;
158
163
  }
159
164
 
165
+ /// Bypass FocusZone if it's empty or has no focusable elements
166
+ static BOOL ShouldSkipFocusZone(NSView *view)
167
+ {
168
+ if([view isKindOfClass:[RCTFocusZone class]])
169
+ {
170
+ NSView *keyView = GetFirstKeyViewWithin(view);
171
+ // FocusZone is empty or has no focusable elements
172
+ if (keyView == nil)
173
+ {
174
+ return YES;
175
+ }
176
+ }
177
+
178
+ return NO;
179
+ }
180
+ /// Accept firstResponder on FocusZone itself in order to reassign it within the FocusZone.
160
181
  - (BOOL)acceptsFirstResponder
161
182
  {
162
- // Accept firstResponder on FocusZone itself in order to reassign it within the FocusZone.
163
- return !_disabled;
183
+ // Reject first responder if FocusZone is disabled or should be skipped.
184
+ return !_disabled && !ShouldSkipFocusZone(self);
164
185
  }
165
186
 
166
187
  - (BOOL)becomeFirstResponder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/focus-zone",
3
- "version": "0.9.13",
3
+ "version": "0.9.16",
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",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@fluentui-react-native/component-cache": "^1.3.2",
26
- "@fluentui-react-native/interactive-hooks": ">=0.14.6 <1.0.0",
26
+ "@fluentui-react-native/interactive-hooks": ">=0.14.8 <1.0.0",
27
27
  "@uifabricshared/foundation-composable": ">=0.10.3 <1.0.0",
28
28
  "@uifabricshared/foundation-settings": ">=0.11.3 <1.0.0"
29
29
  },