Skip to content

Commit 37e97c2

Browse files
acoates-mschiaramooneyjonthysellrnbot
authored
[0.76] Cherry-pick changes (#13982)
* [Fabric] Implement IExpandCollapseProvider (#13892) * Implement IExpandCollapseProvider * Change files * Adjust Example * Format + Update Snapshots * [Fabric] implement tooltip property (#13941) * [Fabric] implement view tooltip property * format * Change files * update * Fix lingering tooltip if component is unmounted while tooltip showing * snapshot --------- Co-authored-by: Jon Thysell <[email protected]> * Fix RootComponentView leak (#13959) * Fix RootComponentView leak * Change files * format --------- Co-authored-by: React-Native-Windows Bot <[email protected]> * Add Support for AccessibilityState:Busy (#13952) * Support AccessibilityState: Busy * Change files * Add Testing * Update Snapshots * Update for Leak --------- Co-authored-by: Chiara Mooney <[email protected]> Co-authored-by: Jon Thysell <[email protected]> Co-authored-by: React-Native-Windows Bot <[email protected]>
1 parent e6a4c81 commit 37e97c2

36 files changed

+731
-39
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Support AccessibilityState: Busy",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Fix RootComponentView leak",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "[Fabric] implement view tooltip property",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Implement IExpandCollapseProvider",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/@react-native-windows/tester/src/js/examples/View/ViewExample.windows.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ class AccessibilityExample extends React.Component<
544544
> {
545545
state: {tap: number} = {
546546
tap: 0,
547+
expanded: true,
547548
};
548549

549550
render(): React.Node {
@@ -554,10 +555,10 @@ class AccessibilityExample extends React.Component<
554555
accessibilityRole="button"
555556
accessibilityValue={{now: this.state.tap}}
556557
accessibilityActions={[
557-
{name: 'cut', label: 'cut'},
558-
{name: 'copy', label: 'copy'},
559-
{name: 'paste', label: 'paste'},
558+
{name: 'expand', label: 'expand'},
559+
{name: 'collapse', label: 'collapse'},
560560
]}
561+
accessibilityState={{expanded: this.state.expanded, busy: true}}
561562
accessibilityPosInSet={1}
562563
accessibilitySetSize={1}
563564
accessibilityLiveRegion='polite'
@@ -566,19 +567,19 @@ class AccessibilityExample extends React.Component<
566567
focusable
567568
onAccessibilityAction={event => {
568569
switch (event.nativeEvent.actionName) {
569-
case 'cut':
570-
Alert.alert('Alert', 'cut action success');
571-
break;
572-
case 'copy':
573-
Alert.alert('Alert', 'copy action success');
574-
break;
575-
case 'paste':
576-
Alert.alert('Alert', 'paste action success');
570+
case 'expand':
571+
this.setState({expanded: true})
577572
break;
573+
case 'collapse':
574+
this.setState({expanded: false})
578575
}
579576
}}
580577
onAccessibilityTap={() => {
581578
this.setState({tap: this.state.tap + 1});
579+
}}
580+
onPress={()=>{
581+
this.setState({expanded: !this.state.expanded});
582+
console.log('Pressed');
582583
}}>
583584
<Text>A View with accessibility values.</Text>
584585
<Text>Current Number of Accessibility Taps: {this.state.tap}</Text>

packages/e2e-test-app-fabric/test/__snapshots__/ViewComponentTest.test.ts.snap

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,10 @@ exports[`View Tests Views can have customized accessibility 1`] = `
10941094
"Automation Tree": {
10951095
"AutomationId": "accessibility",
10961096
"ControlType": 50000,
1097+
"ExpandCollapsePattern.ExpandCollapseState": "Expanded",
10971098
"HelpText": "Accessibility Hint",
10981099
"IsKeyboardFocusable": true,
1100+
"ItemStatus": "Busy",
10991101
"LiveSetting": "Polite",
11001102
"LocalizedControlType": "button",
11011103
"Name": "A View with accessibility values",
@@ -6084,12 +6086,24 @@ exports[`View Tests Views can have tooltips 1`] = `
60846086
"_Props": {},
60856087
},
60866088
{
6087-
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6089+
"Type": "Microsoft.ReactNative.Composition.ViewComponentView",
60886090
"_Props": {},
6091+
"__Children": [
6092+
{
6093+
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6094+
"_Props": {},
6095+
},
6096+
],
60896097
},
60906098
{
6091-
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6099+
"Type": "Microsoft.ReactNative.Composition.ViewComponentView",
60926100
"_Props": {},
6101+
"__Children": [
6102+
{
6103+
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6104+
"_Props": {},
6105+
},
6106+
],
60936107
},
60946108
],
60956109
},
@@ -6125,6 +6139,25 @@ exports[`View Tests Views can have tooltips 1`] = `
61256139
"Offset": "0, 0, 0",
61266140
"Size": "916, 15",
61276141
"Visual Type": "SpriteVisual",
6142+
"__Children": [
6143+
{
6144+
"Offset": "0, 0, 0",
6145+
"Size": "916, 15",
6146+
"Visual Type": "SpriteVisual",
6147+
"__Children": [
6148+
{
6149+
"Offset": "0, 0, 0",
6150+
"Size": "916, 15",
6151+
"Visual Type": "SpriteVisual",
6152+
},
6153+
{
6154+
"Offset": "0, 0, 0",
6155+
"Size": "0, 0",
6156+
"Visual Type": "SpriteVisual",
6157+
},
6158+
],
6159+
},
6160+
],
61286161
},
61296162
{
61306163
"Offset": "0, 0, 0",
@@ -6135,13 +6168,32 @@ exports[`View Tests Views can have tooltips 1`] = `
61356168
},
61366169
{
61376170
"Offset": "0, 29, 0",
6138-
"Size": "916, 16",
6171+
"Size": "916, 14",
61396172
"Visual Type": "SpriteVisual",
61406173
"__Children": [
61416174
{
61426175
"Offset": "0, 0, 0",
6143-
"Size": "916, 16",
6176+
"Size": "916, 14",
61446177
"Visual Type": "SpriteVisual",
6178+
"__Children": [
6179+
{
6180+
"Offset": "0, 0, 0",
6181+
"Size": "916, 16",
6182+
"Visual Type": "SpriteVisual",
6183+
"__Children": [
6184+
{
6185+
"Offset": "0, 0, 0",
6186+
"Size": "916, 16",
6187+
"Visual Type": "SpriteVisual",
6188+
},
6189+
{
6190+
"Offset": "0, 0, 0",
6191+
"Size": "0, 0",
6192+
"Visual Type": "SpriteVisual",
6193+
},
6194+
],
6195+
},
6196+
],
61456197
},
61466198
{
61476199
"Offset": "0, 0, 0",

packages/e2e-test-app-fabric/test/__snapshots__/snapshotPages.test.js.snap

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77745,16 +77745,12 @@ exports[`snapshotAllPages View 22`] = `
7774577745
accessibilityActions={
7774677746
[
7774777747
{
77748-
"label": "cut",
77749-
"name": "cut",
77748+
"label": "expand",
77749+
"name": "expand",
7775077750
},
7775177751
{
77752-
"label": "copy",
77753-
"name": "copy",
77754-
},
77755-
{
77756-
"label": "paste",
77757-
"name": "paste",
77752+
"label": "collapse",
77753+
"name": "collapse",
7775877754
},
7775977755
]
7776077756
}
@@ -77764,6 +77760,12 @@ exports[`snapshotAllPages View 22`] = `
7776477760
accessibilityPosInSet={1}
7776577761
accessibilityRole="button"
7776677762
accessibilitySetSize={1}
77763+
accessibilityState={
77764+
{
77765+
"busy": true,
77766+
"expanded": true,
77767+
}
77768+
}
7776777769
accessibilityValue={
7776877770
{
7776977771
"now": 0,
@@ -77773,6 +77775,7 @@ exports[`snapshotAllPages View 22`] = `
7777377775
focusable={true}
7777477776
onAccessibilityAction={[Function]}
7777577777
onAccessibilityTap={[Function]}
77778+
onPress={[Function]}
7777677779
testID="accessibility"
7777777780
>
7777877781
<Text>

packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,23 @@ void InsertToggleStateValueIfNotDefault(
314314
}
315315
}
316316

317+
void InsertExpandCollapseStateValueIfNotDefault(
318+
const winrt::Windows::Data::Json::JsonObject &obj,
319+
winrt::hstring name,
320+
ExpandCollapseState value,
321+
ExpandCollapseState defaultValue = ExpandCollapseState::ExpandCollapseState_Collapsed) {
322+
if (value != defaultValue) {
323+
switch (value) {
324+
case 0:
325+
obj.Insert(name, winrt::Windows::Data::Json::JsonValue::CreateStringValue(L"Collapsed"));
326+
break;
327+
case 1:
328+
obj.Insert(name, winrt::Windows::Data::Json::JsonValue::CreateStringValue(L"Expanded"));
329+
break;
330+
}
331+
}
332+
}
333+
317334
winrt::Windows::Data::Json::JsonObject ListErrors(winrt::Windows::Data::Json::JsonValue payload) {
318335
winrt::Windows::Data::Json::JsonObject result;
319336
winrt::Windows::Data::Json::JsonArray jsonErrors;
@@ -339,6 +356,7 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat
339356
BOOL isReadOnly;
340357
ToggleState toggleState;
341358
IValueProvider *valuePattern;
359+
ExpandCollapseState expandCollapseState;
342360
HRESULT hr;
343361

344362
// Dump IValueProvider Information
@@ -365,6 +383,18 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat
365383
}
366384
togglePattern->Release();
367385
}
386+
387+
// Dump IExpandCollapseProvider Information
388+
IExpandCollapseProvider *expandCollapsePattern;
389+
hr = pTarget->GetCurrentPattern(UIA_ExpandCollapsePatternId, reinterpret_cast<IUnknown **>(&expandCollapsePattern));
390+
if (SUCCEEDED(hr) && expandCollapsePattern) {
391+
hr = expandCollapsePattern->get_ExpandCollapseState(&expandCollapseState);
392+
if (SUCCEEDED(hr)) {
393+
InsertExpandCollapseStateValueIfNotDefault(
394+
result, L"ExpandCollapsePattern.ExpandCollapseState", expandCollapseState);
395+
}
396+
expandCollapsePattern->Release();
397+
}
368398
}
369399

370400
winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
@@ -381,6 +411,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
381411
int positionInSet = 0;
382412
int sizeOfSet = 0;
383413
LiveSetting liveSetting = LiveSetting::Off;
414+
BSTR itemStatus;
384415

385416
pTarget->get_CurrentAutomationId(&automationId);
386417
pTarget->get_CurrentControlType(&controlType);
@@ -389,6 +420,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
389420
pTarget->get_CurrentIsKeyboardFocusable(&isKeyboardFocusable);
390421
pTarget->get_CurrentLocalizedControlType(&localizedControlType);
391422
pTarget->get_CurrentName(&name);
423+
pTarget->get_CurrentItemStatus(&itemStatus);
392424
IUIAutomationElement4 *pTarget4;
393425
HRESULT hr = pTarget->QueryInterface(__uuidof(IUIAutomationElement4), reinterpret_cast<void **>(&pTarget4));
394426
if (SUCCEEDED(hr) && pTarget4) {
@@ -408,6 +440,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
408440
InsertIntValueIfNotDefault(result, L"PositionInSet", positionInSet);
409441
InsertIntValueIfNotDefault(result, L"SizeofSet", sizeOfSet);
410442
InsertLiveSettingValueIfNotDefault(result, L"LiveSetting", liveSetting);
443+
InsertStringValueIfNotEmpty(result, L"ItemStatus", itemStatus);
411444
DumpUIAPatternInfo(pTarget, result);
412445

413446
IUIAutomationElement *pChild;
@@ -423,6 +456,11 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
423456
if (children.Size() > 0) {
424457
result.Insert(L"__Children", children);
425458
}
459+
::SysFreeString(automationId);
460+
::SysFreeString(helpText);
461+
::SysFreeString(localizedControlType);
462+
::SysFreeString(name);
463+
::SysFreeString(itemStatus);
426464
return result;
427465
}
428466

packages/e2e-test-app/test/__snapshots__/ViewComponentTest.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ exports[`ViewTests Views can have a custom nativeID 1`] = `
363363
exports[`ViewTests Views can have accessibility customization 1`] = `
364364
{
365365
"AccessibilityRole": "Button",
366+
"AccessibilityStateBusy": true,
367+
"AccessibilityStateExpanded": true,
366368
"AutomationId": "accessibility",
367369
"AutomationPositionInSet": 1,
368370
"AutomationSizeOfSet": 1,

vnext/Desktop.DLL/React.Windows.Desktop.DLL.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
comsuppw.lib;
104104
Shlwapi.lib;
105105
Version.lib;
106+
Dwmapi.lib;
106107
WindowsApp_downlevel.lib;
107108
%(AdditionalDependencies)
108109
</AdditionalDependencies>

0 commit comments

Comments
 (0)