@fluentui-react-native/focus-zone 0.9.16 → 0.9.19
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 +46 -1
- package/CHANGELOG.md +26 -2
- package/macos/RCTFocusZone.m +35 -32
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,52 @@
|
|
|
2
2
|
"name": "@fluentui-react-native/focus-zone",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 13 Apr 2022 23:43:42 GMT",
|
|
6
|
+
"tag": "@fluentui-react-native/focus-zone_v0.9.19",
|
|
7
|
+
"version": "0.9.19",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui-react-native/focus-zone",
|
|
13
|
+
"comment": "Bump @fluentui-react-native/interactive-hooks to v0.15.0",
|
|
14
|
+
"commit": "129f628a9676a93f10466cea6efdfff1243e86f0"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 12 Apr 2022 21:53:04 GMT",
|
|
21
|
+
"tag": "@fluentui-react-native/focus-zone_v0.9.18",
|
|
22
|
+
"version": "0.9.18",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "sanajmi@microsoft.com",
|
|
27
|
+
"package": "@fluentui-react-native/focus-zone",
|
|
28
|
+
"commit": "86b38c2e20e29fb4248bfd64e534da45deb35dfa",
|
|
29
|
+
"comment": "Scroll scrollView when Focus moves out of viewport"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Tue, 12 Apr 2022 00:35:08 GMT",
|
|
36
|
+
"tag": "@fluentui-react-native/focus-zone_v0.9.17",
|
|
37
|
+
"version": "0.9.17",
|
|
38
|
+
"comments": {
|
|
39
|
+
"patch": [
|
|
40
|
+
{
|
|
41
|
+
"author": "sanajmi@microsoft.com",
|
|
42
|
+
"package": "@fluentui-react-native/focus-zone",
|
|
43
|
+
"commit": "832066543f281fdec866f738d36f7f73f6bbb4f7",
|
|
44
|
+
"comment": "Add support for nested focus zones"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Fri, 08 Apr 2022 18:53:11 GMT",
|
|
6
51
|
"tag": "@fluentui-react-native/focus-zone_v0.9.16",
|
|
7
52
|
"version": "0.9.16",
|
|
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
|
|
3
|
+
This log was last generated on Wed, 13 Apr 2022 23:43:42 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.9.19
|
|
8
|
+
|
|
9
|
+
Wed, 13 Apr 2022 23:43:42 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @fluentui-react-native/interactive-hooks to v0.15.0
|
|
14
|
+
|
|
15
|
+
## 0.9.18
|
|
16
|
+
|
|
17
|
+
Tue, 12 Apr 2022 21:53:04 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- Scroll scrollView when Focus moves out of viewport (sanajmi@microsoft.com)
|
|
22
|
+
|
|
23
|
+
## 0.9.17
|
|
24
|
+
|
|
25
|
+
Tue, 12 Apr 2022 00:35:08 GMT
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- Add support for nested focus zones (sanajmi@microsoft.com)
|
|
30
|
+
|
|
7
31
|
## 0.9.16
|
|
8
32
|
|
|
9
|
-
Fri, 08 Apr 2022 18:
|
|
33
|
+
Fri, 08 Apr 2022 18:53:11 GMT
|
|
10
34
|
|
|
11
35
|
### Patches
|
|
12
36
|
|
package/macos/RCTFocusZone.m
CHANGED
|
@@ -147,36 +147,40 @@ static inline BOOL IsHorizontalNavigationWithinZoneAction(FocusZoneAction action
|
|
|
147
147
|
return action == FocusZoneActionRightArrow || action == FocusZoneActionLeftArrow;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/// Returns the topmost view of the given view's superview heirarchy that is a FocusZone.
|
|
151
|
+
/// Returns nil if no FocusZone is found.
|
|
150
152
|
static RCTFocusZone *GetFocusZoneAncestor(NSView *view)
|
|
151
153
|
{
|
|
152
154
|
NSView *candidateView = view;
|
|
153
155
|
NSView *topLevelView = [[view window] contentView];
|
|
156
|
+
RCTFocusZone *focusZoneAncestor = nil;
|
|
154
157
|
while (candidateView != nil && candidateView != topLevelView)
|
|
155
158
|
{
|
|
156
159
|
if ([candidateView isKindOfClass:[RCTFocusZone class]])
|
|
157
160
|
{
|
|
158
|
-
|
|
161
|
+
focusZoneAncestor = (RCTFocusZone *)candidateView;
|
|
159
162
|
}
|
|
160
163
|
candidateView = [candidateView superview];
|
|
161
164
|
}
|
|
162
|
-
return
|
|
165
|
+
return focusZoneAncestor;
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
/// Bypass FocusZone if it's empty or has no focusable elements
|
|
166
169
|
static BOOL ShouldSkipFocusZone(NSView *view)
|
|
167
170
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
if([view isKindOfClass:[RCTFocusZone class]])
|
|
172
|
+
{
|
|
173
|
+
NSView *keyView = GetFirstKeyViewWithin(view);
|
|
174
|
+
// FocusZone is empty or has no focusable elements
|
|
175
|
+
if (keyView == nil)
|
|
176
|
+
{
|
|
177
|
+
return YES;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
177
180
|
|
|
178
|
-
|
|
181
|
+
return NO;
|
|
179
182
|
}
|
|
183
|
+
|
|
180
184
|
/// Accept firstResponder on FocusZone itself in order to reassign it within the FocusZone.
|
|
181
185
|
- (BOOL)acceptsFirstResponder
|
|
182
186
|
{
|
|
@@ -362,34 +366,32 @@ static BOOL ShouldSkipFocusZone(NSView *view)
|
|
|
362
366
|
NSView *nextViewToFocus;
|
|
363
367
|
|
|
364
368
|
[[self window] recalculateKeyViewLoop];
|
|
369
|
+
|
|
370
|
+
// Find the first view outside the FocusZone (or any parent FocusZones) to place focus
|
|
371
|
+
RCTFocusZone *focusZoneAncestor = GetFocusZoneAncestor(self);
|
|
365
372
|
|
|
366
373
|
if (action == FocusZoneActionTab) // Advance to next zone
|
|
367
374
|
{
|
|
368
|
-
|
|
375
|
+
nextViewToFocus = [self nextValidKeyView];
|
|
376
|
+
while([nextViewToFocus isDescendantOf:focusZoneAncestor])
|
|
369
377
|
{
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
nextViewToFocus = [([self nextViewToFocusForCondition:block] ?: self) nextValidKeyView];
|
|
374
|
-
}
|
|
375
|
-
else // action == FocusZoneActionShiftTab per the conditional in keyDown
|
|
376
|
-
{
|
|
377
|
-
nextViewToFocus = [self previousValidKeyView];
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
if ([nextViewToFocus isDescendantOf:self])
|
|
381
|
-
{
|
|
382
|
-
nextViewToFocus = nil;
|
|
378
|
+
nextViewToFocus = [nextViewToFocus nextValidKeyView];
|
|
379
|
+
}
|
|
383
380
|
}
|
|
384
381
|
else if (action == FocusZoneActionShiftTab)
|
|
385
382
|
{
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
RCTFocusZone *nextFocusZone = GetFocusZoneAncestor(nextViewToFocus);
|
|
389
|
-
NSView *element = [nextFocusZone defaultKeyView];
|
|
390
|
-
if (element != nil)
|
|
383
|
+
nextViewToFocus = [self previousValidKeyView];
|
|
384
|
+
while([nextViewToFocus isDescendantOf:focusZoneAncestor])
|
|
391
385
|
{
|
|
392
|
-
nextViewToFocus =
|
|
386
|
+
nextViewToFocus = [nextViewToFocus previousValidKeyView];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// If the previous view is in a FocusZone, focus on its defaultKeyView
|
|
390
|
+
// (For FocusZoneActionTab, this is handled by becomeFirstResponder).
|
|
391
|
+
RCTFocusZone *focusZoneAncestor = GetFocusZoneAncestor(nextViewToFocus);
|
|
392
|
+
NSView *ancestorKeyView = [focusZoneAncestor defaultKeyView];
|
|
393
|
+
if (ancestorKeyView != nil) {
|
|
394
|
+
nextViewToFocus = [focusZoneAncestor defaultKeyView];
|
|
393
395
|
}
|
|
394
396
|
}
|
|
395
397
|
|
|
@@ -433,6 +435,7 @@ static BOOL ShouldSkipFocusZone(NSView *view)
|
|
|
433
435
|
if (!passthrough && viewToFocus != nil)
|
|
434
436
|
{
|
|
435
437
|
[[self window] makeFirstResponder:viewToFocus];
|
|
438
|
+
[viewToFocus scrollRectToVisible:[viewToFocus bounds]];
|
|
436
439
|
}
|
|
437
440
|
else
|
|
438
441
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/focus-zone",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.19",
|
|
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.
|
|
26
|
+
"@fluentui-react-native/interactive-hooks": ">=0.15.0 <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
|
},
|