@fluentui-react-native/focus-zone 0.9.15 → 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,22 @@
2
2
  "name": "@fluentui-react-native/focus-zone",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 06 Apr 2022 22:56:55 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",
6
21
  "tag": "@fluentui-react-native/focus-zone_v0.9.15",
7
22
  "version": "0.9.15",
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 Wed, 06 Apr 2022 22:56:55 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
+
7
15
  ## 0.9.15
8
16
 
9
- Wed, 06 Apr 2022 22:56:55 GMT
17
+ Wed, 06 Apr 2022 22:58:22 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -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.15",
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",