Skip to content

Commit 499b89b

Browse files
acoates-mschiaramooneyrnbotjonthysell
authored
[0.75] Cherry-pick changes (#13981)
* Add Support for AccessibilityState:Busy (#13952) * Support AccessibilityState: Busy * Change files * Add Testing * Update Snapshots * Update for Leak * Fix RootComponentView leak (#13959) * Fix RootComponentView leak * Change files * format --------- Co-authored-by: React-Native-Windows Bot <53619745+rnbot@users.noreply.github.com> * [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 <jthysell@microsoft.com> * [Fabric] Implement IExpandCollapseProvider (#13892) * Implement IExpandCollapseProvider * Change files * Adjust Example * Format + Update Snapshots * Change files prerelease->patch * update snapshots --------- Co-authored-by: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com> Co-authored-by: React-Native-Windows Bot <53619745+rnbot@users.noreply.github.com> Co-authored-by: Jon Thysell <jthysell@microsoft.com>
1 parent bb1112c commit 499b89b

36 files changed

+747
-39
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Support AccessibilityState: Busy",
4+
"packageName": "react-native-windows",
5+
"email": "34109996+chiaramooney@users.noreply.github.com",
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": "patch",
3+
"comment": "Fix RootComponentView leak",
4+
"packageName": "react-native-windows",
5+
"email": "53619745+rnbot@users.noreply.github.com",
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": "patch",
3+
"comment": "[Fabric] implement view tooltip property",
4+
"packageName": "react-native-windows",
5+
"email": "30809111+acoates-ms@users.noreply.github.com",
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": "patch",
3+
"comment": "Implement IExpandCollapseProvider",
4+
"packageName": "react-native-windows",
5+
"email": "34109996+chiaramooney@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ class AccessibilityExample extends React.Component<
463463
> {
464464
state: {tap: number} = {
465465
tap: 0,
466+
expanded: true,
466467
};
467468

468469
render(): React.Node {
@@ -473,28 +474,31 @@ class AccessibilityExample extends React.Component<
473474
accessibilityRole="button"
474475
accessibilityValue={0}
475476
accessibilityActions={[
476-
{name: 'cut', label: 'cut'},
477-
{name: 'copy', label: 'copy'},
478-
{name: 'paste', label: 'paste'},
477+
{name: 'expand', label: 'expand'},
478+
{name: 'collapse', label: 'collapse'},
479479
]}
480+
accessibilityState={{expanded: this.state.expanded, busy: true}}
481+
accessibilityPosInSet={1}
482+
accessibilitySetSize={1}
483+
accessibilityLiveRegion='polite'
480484
testID="accessibility"
481485
accessible
482486
focusable
483487
onAccessibilityAction={event => {
484488
switch (event.nativeEvent.actionName) {
485-
case 'cut':
486-
Alert.alert('Alert', 'cut action success');
487-
break;
488-
case 'copy':
489-
Alert.alert('Alert', 'copy action success');
490-
break;
491-
case 'paste':
492-
Alert.alert('Alert', 'paste action success');
489+
case 'expand':
490+
this.setState({expanded: true})
493491
break;
492+
case 'collapse':
493+
this.setState({expanded: false})
494494
}
495495
}}
496496
onAccessibilityTap={() => {
497497
this.setState({tap: this.state.tap + 1});
498+
}}
499+
onPress={()=>{
500+
this.setState({expanded: !this.state.expanded});
501+
console.log('Pressed');
498502
}}>
499503
<Text>A View with accessibility values.</Text>
500504
<Text>Current Number of Accessibility Taps: {this.state.tap}</Text>

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

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,10 +1094,15 @@ 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",
1101+
"LiveSetting": "Polite",
10991102
"LocalizedControlType": "button",
11001103
"Name": "A View with accessibility values",
1104+
"PositionInSet": 1,
1105+
"SizeofSet": 1,
11011106
"__Children": [
11021107
{
11031108
"AutomationId": "",
@@ -6021,12 +6026,24 @@ exports[`View Tests Views can have tooltips 1`] = `
60216026
"_Props": {},
60226027
},
60236028
{
6024-
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6029+
"Type": "Microsoft.ReactNative.Composition.ViewComponentView",
60256030
"_Props": {},
6031+
"__Children": [
6032+
{
6033+
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6034+
"_Props": {},
6035+
},
6036+
],
60266037
},
60276038
{
6028-
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6039+
"Type": "Microsoft.ReactNative.Composition.ViewComponentView",
60296040
"_Props": {},
6041+
"__Children": [
6042+
{
6043+
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
6044+
"_Props": {},
6045+
},
6046+
],
60306047
},
60316048
],
60326049
},
@@ -6062,6 +6079,25 @@ exports[`View Tests Views can have tooltips 1`] = `
60626079
"Offset": "0, 0, 0",
60636080
"Size": "916, 15",
60646081
"Visual Type": "SpriteVisual",
6082+
"__Children": [
6083+
{
6084+
"Offset": "0, 0, 0",
6085+
"Size": "916, 15",
6086+
"Visual Type": "SpriteVisual",
6087+
"__Children": [
6088+
{
6089+
"Offset": "0, 0, 0",
6090+
"Size": "916, 15",
6091+
"Visual Type": "SpriteVisual",
6092+
},
6093+
{
6094+
"Offset": "0, 0, 0",
6095+
"Size": "0, 0",
6096+
"Visual Type": "SpriteVisual",
6097+
},
6098+
],
6099+
},
6100+
],
60656101
},
60666102
{
60676103
"Offset": "0, 0, 0",
@@ -6072,13 +6108,32 @@ exports[`View Tests Views can have tooltips 1`] = `
60726108
},
60736109
{
60746110
"Offset": "0, 29, 0",
6075-
"Size": "916, 16",
6111+
"Size": "916, 14",
60766112
"Visual Type": "SpriteVisual",
60776113
"__Children": [
60786114
{
60796115
"Offset": "0, 0, 0",
6080-
"Size": "916, 16",
6116+
"Size": "916, 14",
60816117
"Visual Type": "SpriteVisual",
6118+
"__Children": [
6119+
{
6120+
"Offset": "0, 0, 0",
6121+
"Size": "916, 16",
6122+
"Visual Type": "SpriteVisual",
6123+
"__Children": [
6124+
{
6125+
"Offset": "0, 0, 0",
6126+
"Size": "916, 16",
6127+
"Visual Type": "SpriteVisual",
6128+
},
6129+
{
6130+
"Offset": "0, 0, 0",
6131+
"Size": "0, 0",
6132+
"Visual Type": "SpriteVisual",
6133+
},
6134+
],
6135+
},
6136+
],
60826137
},
60836138
{
60846139
"Offset": "0, 0, 0",

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67813,27 +67813,33 @@ exports[`snapshotAllPages View 21`] = `
6781367813
accessibilityActions={
6781467814
[
6781567815
{
67816-
"label": "cut",
67817-
"name": "cut",
67816+
"label": "expand",
67817+
"name": "expand",
6781867818
},
6781967819
{
67820-
"label": "copy",
67821-
"name": "copy",
67822-
},
67823-
{
67824-
"label": "paste",
67825-
"name": "paste",
67820+
"label": "collapse",
67821+
"name": "collapse",
6782667822
},
6782767823
]
6782867824
}
6782967825
accessibilityHint="Accessibility Hint"
6783067826
accessibilityLabel="A View with accessibility values"
67827+
accessibilityLiveRegion="polite"
67828+
accessibilityPosInSet={1}
6783167829
accessibilityRole="button"
67830+
accessibilitySetSize={1}
67831+
accessibilityState={
67832+
{
67833+
"busy": true,
67834+
"expanded": true,
67835+
}
67836+
}
6783267837
accessibilityValue={0}
6783367838
accessible={true}
6783467839
focusable={true}
6783567840
onAccessibilityAction={[Function]}
6783667841
onAccessibilityTap={[Function]}
67842+
onPress={[Function]}
6783767843
testID="accessibility"
6783867844
>
6783967845
<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
@@ -312,6 +312,23 @@ void InsertToggleStateValueIfNotDefault(
312312
}
313313
}
314314

315+
void InsertExpandCollapseStateValueIfNotDefault(
316+
const winrt::Windows::Data::Json::JsonObject &obj,
317+
winrt::hstring name,
318+
ExpandCollapseState value,
319+
ExpandCollapseState defaultValue = ExpandCollapseState::ExpandCollapseState_Collapsed) {
320+
if (value != defaultValue) {
321+
switch (value) {
322+
case 0:
323+
obj.Insert(name, winrt::Windows::Data::Json::JsonValue::CreateStringValue(L"Collapsed"));
324+
break;
325+
case 1:
326+
obj.Insert(name, winrt::Windows::Data::Json::JsonValue::CreateStringValue(L"Expanded"));
327+
break;
328+
}
329+
}
330+
}
331+
315332
winrt::Windows::Data::Json::JsonObject ListErrors(winrt::Windows::Data::Json::JsonValue payload) {
316333
winrt::Windows::Data::Json::JsonObject result;
317334
winrt::Windows::Data::Json::JsonArray jsonErrors;
@@ -337,6 +354,7 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat
337354
BOOL isReadOnly;
338355
ToggleState toggleState;
339356
IValueProvider *valuePattern;
357+
ExpandCollapseState expandCollapseState;
340358
HRESULT hr;
341359

342360
// Dump IValueProvider Information
@@ -363,6 +381,18 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat
363381
}
364382
togglePattern->Release();
365383
}
384+
385+
// Dump IExpandCollapseProvider Information
386+
IExpandCollapseProvider *expandCollapsePattern;
387+
hr = pTarget->GetCurrentPattern(UIA_ExpandCollapsePatternId, reinterpret_cast<IUnknown **>(&expandCollapsePattern));
388+
if (SUCCEEDED(hr) && expandCollapsePattern) {
389+
hr = expandCollapsePattern->get_ExpandCollapseState(&expandCollapseState);
390+
if (SUCCEEDED(hr)) {
391+
InsertExpandCollapseStateValueIfNotDefault(
392+
result, L"ExpandCollapsePattern.ExpandCollapseState", expandCollapseState);
393+
}
394+
expandCollapsePattern->Release();
395+
}
366396
}
367397

368398
winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
@@ -379,6 +409,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
379409
int positionInSet = 0;
380410
int sizeOfSet = 0;
381411
LiveSetting liveSetting = LiveSetting::Off;
412+
BSTR itemStatus;
382413

383414
pTarget->get_CurrentAutomationId(&automationId);
384415
pTarget->get_CurrentControlType(&controlType);
@@ -387,6 +418,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
387418
pTarget->get_CurrentIsKeyboardFocusable(&isKeyboardFocusable);
388419
pTarget->get_CurrentLocalizedControlType(&localizedControlType);
389420
pTarget->get_CurrentName(&name);
421+
pTarget->get_CurrentItemStatus(&itemStatus);
390422
IUIAutomationElement4 *pTarget4;
391423
HRESULT hr = pTarget->QueryInterface(__uuidof(IUIAutomationElement4), reinterpret_cast<void **>(&pTarget4));
392424
if (SUCCEEDED(hr) && pTarget4) {
@@ -406,6 +438,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
406438
InsertIntValueIfNotDefault(result, L"PositionInSet", positionInSet);
407439
InsertIntValueIfNotDefault(result, L"SizeofSet", sizeOfSet);
408440
InsertLiveSettingValueIfNotDefault(result, L"LiveSetting", liveSetting);
441+
InsertStringValueIfNotEmpty(result, L"ItemStatus", itemStatus);
409442
DumpUIAPatternInfo(pTarget, result);
410443

411444
IUIAutomationElement *pChild;
@@ -421,6 +454,11 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
421454
if (children.Size() > 0) {
422455
result.Insert(L"__Children", children);
423456
}
457+
::SysFreeString(automationId);
458+
::SysFreeString(helpText);
459+
::SysFreeString(localizedControlType);
460+
::SysFreeString(name);
461+
::SysFreeString(itemStatus);
424462
return result;
425463
}
426464

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ 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",
369+
"AutomationPositionInSet": 1,
370+
"AutomationSizeOfSet": 1,
367371
"Background": null,
368372
"BorderBrush": null,
369373
"BorderThickness": "0,0,0,0",

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)