react-native-windows 0.80.0-preview.7 → 0.80.0-preview.9
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/Microsoft.ReactNative/CompositionSwitcher.idl +3 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +73 -27
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +21 -156
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +24 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +30 -65
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +4 -6
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +216 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +17 -0
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/package.json +2 -2
|
@@ -31,13 +31,6 @@ namespace Microsoft.ReactNative.Composition.Experimental
|
|
|
31
31
|
SwitchThumb,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
enum SnapAlignment
|
|
35
|
-
{
|
|
36
|
-
Start,
|
|
37
|
-
Center,
|
|
38
|
-
End,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
34
|
[webhosthidden]
|
|
42
35
|
[uuid("172def51-9e1a-4e3c-841a-e5a470065acc")] // uuid needed for empty interfaces
|
|
43
36
|
[version(0)]
|
|
@@ -118,6 +111,8 @@ namespace Microsoft.ReactNative.Composition.Experimental
|
|
|
118
111
|
event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollPositionChanged;
|
|
119
112
|
event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollBeginDrag;
|
|
120
113
|
event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollEndDrag;
|
|
114
|
+
event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollMomentumBegin;
|
|
115
|
+
event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollMomentumEnd;
|
|
121
116
|
void ContentSize(Windows.Foundation.Numerics.Vector2 size);
|
|
122
117
|
Windows.Foundation.Numerics.Vector3 ScrollPosition { get; };
|
|
123
118
|
void ScrollBy(Windows.Foundation.Numerics.Vector3 offset, Boolean animate);
|
|
@@ -127,7 +122,7 @@ namespace Microsoft.ReactNative.Composition.Experimental
|
|
|
127
122
|
void SetMaximumZoomScale(Single maximumZoomScale);
|
|
128
123
|
void SetMinimumZoomScale(Single minimumZoomScale);
|
|
129
124
|
Boolean Horizontal;
|
|
130
|
-
void SetSnapPoints(Boolean snapToStart, Boolean snapToEnd, Windows.Foundation.Collections.IVectorView<Single> offsets
|
|
125
|
+
void SetSnapPoints(Boolean snapToStart, Boolean snapToEnd, Windows.Foundation.Collections.IVectorView<Single> offsets);
|
|
131
126
|
}
|
|
132
127
|
|
|
133
128
|
[webhosthidden]
|
|
@@ -27,8 +27,6 @@
|
|
|
27
27
|
|
|
28
28
|
namespace Microsoft::ReactNative::Composition::Experimental {
|
|
29
29
|
|
|
30
|
-
using namespace winrt::Microsoft::ReactNative::Composition::Experimental;
|
|
31
|
-
|
|
32
30
|
template <typename TSpriteVisual>
|
|
33
31
|
struct CompositionTypeTraits {};
|
|
34
32
|
|
|
@@ -711,8 +709,23 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
711
709
|
void IdleStateEntered(
|
|
712
710
|
typename TTypeRedirects::InteractionTracker sender,
|
|
713
711
|
typename TTypeRedirects::InteractionTrackerIdleStateEnteredArgs args) noexcept {
|
|
712
|
+
// If we were in inertia and are now idle, momentum has ended
|
|
713
|
+
if (m_outer->m_inertia) {
|
|
714
|
+
m_outer->FireScrollMomentumEnd({sender.Position().x, sender.Position().y});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// If we were interacting but never entered inertia (Interacting -> Idle),
|
|
718
|
+
// and the interaction was user-driven (requestId == 0), fire end-drag here.
|
|
719
|
+
// Note: if the interactionRequestId was non-zero it was caused by a Try* call
|
|
720
|
+
// (programmatic), so we should not fire onScrollEndDrag.
|
|
721
|
+
if (m_outer->m_interacting && args.RequestId() == 0) {
|
|
722
|
+
m_outer->FireScrollEndDrag({sender.Position().x, sender.Position().y});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// Clear state flags
|
|
714
726
|
m_outer->m_custom = false;
|
|
715
727
|
m_outer->m_inertia = false;
|
|
728
|
+
m_outer->m_interacting = false;
|
|
716
729
|
}
|
|
717
730
|
void InertiaStateEntered(
|
|
718
731
|
typename TTypeRedirects::InteractionTracker sender,
|
|
@@ -720,15 +733,26 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
720
733
|
m_outer->m_custom = false;
|
|
721
734
|
m_outer->m_inertia = true;
|
|
722
735
|
m_outer->m_currentPosition = args.NaturalRestingPosition();
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
736
|
+
|
|
737
|
+
if (!m_outer->m_interacting && args.RequestId() == 0) {
|
|
738
|
+
m_outer->FireScrollBeginDrag({args.NaturalRestingPosition().x, args.NaturalRestingPosition().y});
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// If interaction was user-driven (requestId == 0),
|
|
742
|
+
// fire ScrollEndDrag here (Interacting -> Inertia caused by user lift).
|
|
743
|
+
if (m_outer->m_interacting && args.RequestId() == 0) {
|
|
744
|
+
m_outer->FireScrollEndDrag({args.NaturalRestingPosition().x, args.NaturalRestingPosition().y});
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// Fire momentum scroll begin when we enter inertia (user or programmatic)
|
|
748
|
+
m_outer->FireScrollMomentumBegin({args.NaturalRestingPosition().x, args.NaturalRestingPosition().y});
|
|
728
749
|
}
|
|
729
750
|
void InteractingStateEntered(
|
|
730
751
|
typename TTypeRedirects::InteractionTracker sender,
|
|
731
752
|
typename TTypeRedirects::InteractionTrackerInteractingStateEnteredArgs args) noexcept {
|
|
753
|
+
// Mark that we're now interacting and remember the requestId (user manipulations => 0)
|
|
754
|
+
m_outer->m_interacting = true;
|
|
755
|
+
|
|
732
756
|
// Fire when the user starts dragging the object
|
|
733
757
|
m_outer->FireScrollBeginDrag({sender.Position().x, sender.Position().y});
|
|
734
758
|
}
|
|
@@ -738,6 +762,10 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
738
762
|
void ValuesChanged(
|
|
739
763
|
typename TTypeRedirects::InteractionTracker sender,
|
|
740
764
|
typename TTypeRedirects::InteractionTrackerValuesChangedArgs args) noexcept {
|
|
765
|
+
if (!m_outer->m_interacting && args.RequestId() == 0) {
|
|
766
|
+
m_outer->FireScrollBeginDrag({args.Position().x, args.Position().y});
|
|
767
|
+
}
|
|
768
|
+
m_outer->m_interacting = true;
|
|
741
769
|
m_outer->m_currentPosition = args.Position();
|
|
742
770
|
m_outer->FireScrollPositionChanged({args.Position().x, args.Position().y});
|
|
743
771
|
}
|
|
@@ -873,11 +901,9 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
873
901
|
void SetSnapPoints(
|
|
874
902
|
bool snapToStart,
|
|
875
903
|
bool snapToEnd,
|
|
876
|
-
winrt::Windows::Foundation::Collections::IVectorView<float> const &offsets
|
|
877
|
-
SnapAlignment snapToAlignment) noexcept {
|
|
904
|
+
winrt::Windows::Foundation::Collections::IVectorView<float> const &offsets) noexcept {
|
|
878
905
|
m_snapToStart = snapToStart;
|
|
879
906
|
m_snapToEnd = snapToEnd;
|
|
880
|
-
m_snapToAlignment = snapToAlignment;
|
|
881
907
|
m_snapToOffsets.clear();
|
|
882
908
|
if (offsets) {
|
|
883
909
|
for (auto const &offset : offsets) {
|
|
@@ -985,6 +1011,20 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
985
1011
|
return m_scrollEndDragEvent.add(handler);
|
|
986
1012
|
}
|
|
987
1013
|
|
|
1014
|
+
winrt::event_token ScrollMomentumBegin(
|
|
1015
|
+
winrt::Windows::Foundation::EventHandler<
|
|
1016
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs> const
|
|
1017
|
+
&handler) noexcept {
|
|
1018
|
+
return m_scrollMomentumBeginEvent.add(handler);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
winrt::event_token ScrollMomentumEnd(
|
|
1022
|
+
winrt::Windows::Foundation::EventHandler<
|
|
1023
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs> const
|
|
1024
|
+
&handler) noexcept {
|
|
1025
|
+
return m_scrollMomentumEndEvent.add(handler);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
988
1028
|
void ScrollPositionChanged(winrt::event_token const &token) noexcept {
|
|
989
1029
|
m_scrollPositionChangedEvent.remove(token);
|
|
990
1030
|
}
|
|
@@ -997,6 +1037,14 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
997
1037
|
m_scrollEndDragEvent.remove(token);
|
|
998
1038
|
}
|
|
999
1039
|
|
|
1040
|
+
void ScrollMomentumBegin(winrt::event_token const &token) noexcept {
|
|
1041
|
+
m_scrollMomentumBeginEvent.remove(token);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
void ScrollMomentumEnd(winrt::event_token const &token) noexcept {
|
|
1045
|
+
m_scrollMomentumEndEvent.remove(token);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1000
1048
|
void ContentSize(winrt::Windows::Foundation::Numerics::float2 const &size) noexcept {
|
|
1001
1049
|
m_contentSize = size;
|
|
1002
1050
|
m_contentVisual.Size(size);
|
|
@@ -1075,6 +1123,14 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1075
1123
|
m_scrollEndDragEvent(*this, winrt::make<CompScrollPositionChangedArgs>(position));
|
|
1076
1124
|
}
|
|
1077
1125
|
|
|
1126
|
+
void FireScrollMomentumBegin(winrt::Windows::Foundation::Numerics::float2 position) noexcept {
|
|
1127
|
+
m_scrollMomentumBeginEvent(*this, winrt::make<CompScrollPositionChangedArgs>(position));
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
void FireScrollMomentumEnd(winrt::Windows::Foundation::Numerics::float2 position) noexcept {
|
|
1131
|
+
m_scrollMomentumEndEvent(*this, winrt::make<CompScrollPositionChangedArgs>(position));
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1078
1134
|
void UpdateMaxPosition() noexcept {
|
|
1079
1135
|
m_interactionTracker.MaxPosition(
|
|
1080
1136
|
{std::max<float>(m_contentSize.x - m_visualSize.x, 0),
|
|
@@ -1104,22 +1160,6 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1104
1160
|
}
|
|
1105
1161
|
|
|
1106
1162
|
snapPositions.insert(snapPositions.end(), m_snapToOffsets.begin(), m_snapToOffsets.end());
|
|
1107
|
-
|
|
1108
|
-
// Adjust snap positions based on alignment
|
|
1109
|
-
const float viewportSize = m_horizontal ? visualSize.x : visualSize.y;
|
|
1110
|
-
if (m_snapToAlignment == SnapAlignment::Center) {
|
|
1111
|
-
// For center alignment, offset snap positions by half the viewport size
|
|
1112
|
-
for (auto &position : snapPositions) {
|
|
1113
|
-
position = std::max(0.0f, position - viewportSize / 2.0f);
|
|
1114
|
-
}
|
|
1115
|
-
} else if (m_snapToAlignment == SnapAlignment::End) {
|
|
1116
|
-
// For end alignment, offset snap positions by the full viewport size
|
|
1117
|
-
for (auto &position : snapPositions) {
|
|
1118
|
-
position = std::max(0.0f, position - viewportSize);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
// For Start alignment, no adjustment needed
|
|
1122
|
-
|
|
1123
1163
|
std::sort(snapPositions.begin(), snapPositions.end());
|
|
1124
1164
|
snapPositions.erase(std::unique(snapPositions.begin(), snapPositions.end()), snapPositions.end());
|
|
1125
1165
|
|
|
@@ -1247,9 +1287,9 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1247
1287
|
bool m_snapToStart{true};
|
|
1248
1288
|
bool m_snapToEnd{true};
|
|
1249
1289
|
std::vector<float> m_snapToOffsets;
|
|
1250
|
-
SnapAlignment m_snapToAlignment{SnapAlignment::Start};
|
|
1251
1290
|
bool m_inertia{false};
|
|
1252
1291
|
bool m_custom{false};
|
|
1292
|
+
bool m_interacting{false};
|
|
1253
1293
|
winrt::Windows::Foundation::Numerics::float3 m_targetPosition;
|
|
1254
1294
|
winrt::Windows::Foundation::Numerics::float3 m_currentPosition;
|
|
1255
1295
|
winrt::Windows::Foundation::Numerics::float2 m_contentSize{0};
|
|
@@ -1263,6 +1303,12 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1263
1303
|
winrt::event<winrt::Windows::Foundation::EventHandler<
|
|
1264
1304
|
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs>>
|
|
1265
1305
|
m_scrollEndDragEvent;
|
|
1306
|
+
winrt::event<winrt::Windows::Foundation::EventHandler<
|
|
1307
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs>>
|
|
1308
|
+
m_scrollMomentumBeginEvent;
|
|
1309
|
+
winrt::event<winrt::Windows::Foundation::EventHandler<
|
|
1310
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs>>
|
|
1311
|
+
m_scrollMomentumEndEvent;
|
|
1266
1312
|
typename TTypeRedirects::SpriteVisual m_visual{nullptr};
|
|
1267
1313
|
typename TTypeRedirects::SpriteVisual m_contentVisual{nullptr};
|
|
1268
1314
|
typename TTypeRedirects::InteractionTracker m_interactionTracker{nullptr};
|
|
@@ -313,161 +313,6 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
|
|
|
313
313
|
return S_OK;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
long GetControlTypeFromString(const std::string &role) noexcept {
|
|
317
|
-
if (role == "adjustable") {
|
|
318
|
-
return UIA_SliderControlTypeId;
|
|
319
|
-
} else if (role == "group" || role == "search" || role == "radiogroup" || role == "timer" || role.empty()) {
|
|
320
|
-
return UIA_GroupControlTypeId;
|
|
321
|
-
} else if (role == "button" || role == "imagebutton" || role == "switch" || role == "togglebutton") {
|
|
322
|
-
return UIA_ButtonControlTypeId;
|
|
323
|
-
} else if (role == "checkbox") {
|
|
324
|
-
return UIA_CheckBoxControlTypeId;
|
|
325
|
-
} else if (role == "combobox") {
|
|
326
|
-
return UIA_ComboBoxControlTypeId;
|
|
327
|
-
} else if (role == "alert" || role == "header" || role == "summary" || role == "text") {
|
|
328
|
-
return UIA_TextControlTypeId;
|
|
329
|
-
} else if (role == "image") {
|
|
330
|
-
return UIA_ImageControlTypeId;
|
|
331
|
-
} else if (role == "keyboardkey") {
|
|
332
|
-
return UIA_CustomControlTypeId;
|
|
333
|
-
} else if (role == "link") {
|
|
334
|
-
return UIA_HyperlinkControlTypeId;
|
|
335
|
-
}
|
|
336
|
-
// list and listitem were added by RNW to better support UIA Control Types
|
|
337
|
-
else if (role == "list") {
|
|
338
|
-
return UIA_ListControlTypeId;
|
|
339
|
-
} else if (role == "listitem") {
|
|
340
|
-
return UIA_ListItemControlTypeId;
|
|
341
|
-
} else if (role == "menu") {
|
|
342
|
-
return UIA_MenuControlTypeId;
|
|
343
|
-
} else if (role == "menubar") {
|
|
344
|
-
return UIA_MenuBarControlTypeId;
|
|
345
|
-
} else if (role == "menuitem") {
|
|
346
|
-
return UIA_MenuItemControlTypeId;
|
|
347
|
-
}
|
|
348
|
-
// If role is "none", remove the element from the control tree
|
|
349
|
-
// and expose it as a plain element would in the raw tree.
|
|
350
|
-
else if (role == "none") {
|
|
351
|
-
return UIA_GroupControlTypeId;
|
|
352
|
-
} else if (role == "progressbar") {
|
|
353
|
-
return UIA_ProgressBarControlTypeId;
|
|
354
|
-
} else if (role == "radio") {
|
|
355
|
-
return UIA_RadioButtonControlTypeId;
|
|
356
|
-
} else if (role == "scrollbar") {
|
|
357
|
-
return UIA_ScrollBarControlTypeId;
|
|
358
|
-
} else if (role == "spinbutton") {
|
|
359
|
-
return UIA_SpinnerControlTypeId;
|
|
360
|
-
} else if (role == "splitbutton") {
|
|
361
|
-
return UIA_SplitButtonControlTypeId;
|
|
362
|
-
} else if (role == "tab") {
|
|
363
|
-
return UIA_TabItemControlTypeId;
|
|
364
|
-
} else if (role == "tablist") {
|
|
365
|
-
return UIA_TabControlTypeId;
|
|
366
|
-
} else if (role == "textinput" || role == "searchbox") {
|
|
367
|
-
return UIA_EditControlTypeId;
|
|
368
|
-
} else if (role == "toolbar") {
|
|
369
|
-
return UIA_ToolBarControlTypeId;
|
|
370
|
-
} else if (role == "tree") {
|
|
371
|
-
return UIA_TreeControlTypeId;
|
|
372
|
-
} else if (role == "treeitem") {
|
|
373
|
-
return UIA_TreeItemControlTypeId;
|
|
374
|
-
} else if (role == "pane") {
|
|
375
|
-
return UIA_PaneControlTypeId;
|
|
376
|
-
}
|
|
377
|
-
assert(false);
|
|
378
|
-
return UIA_GroupControlTypeId;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
long GetControlTypeFromRole(const facebook::react::Role &role) noexcept {
|
|
382
|
-
switch (role) {
|
|
383
|
-
case facebook::react::Role::Alert:
|
|
384
|
-
return UIA_TextControlTypeId;
|
|
385
|
-
case facebook::react::Role::Application:
|
|
386
|
-
return UIA_WindowControlTypeId;
|
|
387
|
-
case facebook::react::Role::Button:
|
|
388
|
-
return UIA_ButtonControlTypeId;
|
|
389
|
-
case facebook::react::Role::Checkbox:
|
|
390
|
-
return UIA_CheckBoxControlTypeId;
|
|
391
|
-
case facebook::react::Role::Columnheader:
|
|
392
|
-
return UIA_HeaderControlTypeId;
|
|
393
|
-
case facebook::react::Role::Combobox:
|
|
394
|
-
return UIA_ComboBoxControlTypeId;
|
|
395
|
-
case facebook::react::Role::Document:
|
|
396
|
-
return UIA_DocumentControlTypeId;
|
|
397
|
-
case facebook::react::Role::Grid:
|
|
398
|
-
return UIA_GroupControlTypeId;
|
|
399
|
-
case facebook::react::Role::Group:
|
|
400
|
-
return UIA_GroupControlTypeId;
|
|
401
|
-
case facebook::react::Role::Heading:
|
|
402
|
-
return UIA_TextControlTypeId;
|
|
403
|
-
case facebook::react::Role::Img:
|
|
404
|
-
return UIA_ImageControlTypeId;
|
|
405
|
-
case facebook::react::Role::Link:
|
|
406
|
-
return UIA_HyperlinkControlTypeId;
|
|
407
|
-
case facebook::react::Role::List:
|
|
408
|
-
return UIA_ListControlTypeId;
|
|
409
|
-
case facebook::react::Role::Listitem:
|
|
410
|
-
return UIA_ListItemControlTypeId;
|
|
411
|
-
case facebook::react::Role::Menu:
|
|
412
|
-
return UIA_MenuControlTypeId;
|
|
413
|
-
case facebook::react::Role::Menubar:
|
|
414
|
-
return UIA_MenuBarControlTypeId;
|
|
415
|
-
case facebook::react::Role::Menuitem:
|
|
416
|
-
return UIA_MenuItemControlTypeId;
|
|
417
|
-
case facebook::react::Role::None:
|
|
418
|
-
return UIA_GroupControlTypeId;
|
|
419
|
-
case facebook::react::Role::Presentation:
|
|
420
|
-
return UIA_GroupControlTypeId;
|
|
421
|
-
case facebook::react::Role::Progressbar:
|
|
422
|
-
return UIA_ProgressBarControlTypeId;
|
|
423
|
-
case facebook::react::Role::Radio:
|
|
424
|
-
return UIA_RadioButtonControlTypeId;
|
|
425
|
-
case facebook::react::Role::Radiogroup:
|
|
426
|
-
return UIA_GroupControlTypeId;
|
|
427
|
-
case facebook::react::Role::Rowgroup:
|
|
428
|
-
return UIA_GroupControlTypeId;
|
|
429
|
-
case facebook::react::Role::Rowheader:
|
|
430
|
-
return UIA_HeaderControlTypeId;
|
|
431
|
-
case facebook::react::Role::Scrollbar:
|
|
432
|
-
return UIA_ScrollBarControlTypeId;
|
|
433
|
-
case facebook::react::Role::Searchbox:
|
|
434
|
-
return UIA_EditControlTypeId;
|
|
435
|
-
case facebook::react::Role::Separator:
|
|
436
|
-
return UIA_SeparatorControlTypeId;
|
|
437
|
-
case facebook::react::Role::Slider:
|
|
438
|
-
return UIA_SliderControlTypeId;
|
|
439
|
-
case facebook::react::Role::Spinbutton:
|
|
440
|
-
return UIA_SpinnerControlTypeId;
|
|
441
|
-
case facebook::react::Role::Status:
|
|
442
|
-
return UIA_StatusBarControlTypeId;
|
|
443
|
-
case facebook::react::Role::Summary:
|
|
444
|
-
return UIA_GroupControlTypeId;
|
|
445
|
-
case facebook::react::Role::Switch:
|
|
446
|
-
return UIA_ButtonControlTypeId;
|
|
447
|
-
case facebook::react::Role::Tab:
|
|
448
|
-
return UIA_TabItemControlTypeId;
|
|
449
|
-
case facebook::react::Role::Table:
|
|
450
|
-
return UIA_TableControlTypeId;
|
|
451
|
-
case facebook::react::Role::Tablist:
|
|
452
|
-
return UIA_TabControlTypeId;
|
|
453
|
-
case facebook::react::Role::Tabpanel:
|
|
454
|
-
return UIA_TabControlTypeId;
|
|
455
|
-
case facebook::react::Role::Timer:
|
|
456
|
-
return UIA_ButtonControlTypeId;
|
|
457
|
-
case facebook::react::Role::Toolbar:
|
|
458
|
-
return UIA_ToolBarControlTypeId;
|
|
459
|
-
case facebook::react::Role::Tooltip:
|
|
460
|
-
return UIA_ToolTipControlTypeId;
|
|
461
|
-
case facebook::react::Role::Tree:
|
|
462
|
-
return UIA_TreeControlTypeId;
|
|
463
|
-
case facebook::react::Role::Treegrid:
|
|
464
|
-
return UIA_TreeControlTypeId;
|
|
465
|
-
case facebook::react::Role::Treeitem:
|
|
466
|
-
return UIA_TreeItemControlTypeId;
|
|
467
|
-
}
|
|
468
|
-
return UIA_GroupControlTypeId;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
316
|
HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERTYID propertyId, VARIANT *pRetVal) {
|
|
472
317
|
if (pRetVal == nullptr)
|
|
473
318
|
return E_POINTER;
|
|
@@ -561,7 +406,18 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
|
|
|
561
406
|
}
|
|
562
407
|
case UIA_IsOffscreenPropertyId: {
|
|
563
408
|
pRetVal->vt = VT_BOOL;
|
|
564
|
-
|
|
409
|
+
|
|
410
|
+
// Check if element is offscreen - consider modal content special case
|
|
411
|
+
bool isOffscreen = (compositionView->getClipState() == ClipState::FullyClipped);
|
|
412
|
+
|
|
413
|
+
// Modal content may appear clipped but is visible in its own window
|
|
414
|
+
if (isOffscreen) {
|
|
415
|
+
if (const auto hwnd = compositionView->GetHwndForParenting()) {
|
|
416
|
+
isOffscreen = !(IsWindowVisible(hwnd) && !IsIconic(hwnd));
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
pRetVal->boolVal = isOffscreen ? VARIANT_TRUE : VARIANT_FALSE;
|
|
565
421
|
break;
|
|
566
422
|
}
|
|
567
423
|
case UIA_HelpTextPropertyId: {
|
|
@@ -618,6 +474,11 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
|
|
|
618
474
|
pRetVal->bstrVal = SysAllocString(desc.c_str());
|
|
619
475
|
break;
|
|
620
476
|
}
|
|
477
|
+
case UIA_HeadingLevelPropertyId: {
|
|
478
|
+
pRetVal->vt = VT_I4;
|
|
479
|
+
pRetVal->lVal = GetHeadingLevel(props->accessibilityLevel, props->accessibilityRole, props->role);
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
621
482
|
}
|
|
622
483
|
return hr;
|
|
623
484
|
}
|
|
@@ -1009,7 +870,9 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Expand() {
|
|
|
1009
870
|
|
|
1010
871
|
if (!strongView)
|
|
1011
872
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
873
|
+
|
|
1012
874
|
DispatchAccessibilityAction(m_view, "expand");
|
|
875
|
+
|
|
1013
876
|
return S_OK;
|
|
1014
877
|
}
|
|
1015
878
|
|
|
@@ -1018,7 +881,9 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Collapse() {
|
|
|
1018
881
|
|
|
1019
882
|
if (!strongView)
|
|
1020
883
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
884
|
+
|
|
1021
885
|
DispatchAccessibilityAction(m_view, "collapse");
|
|
886
|
+
|
|
1022
887
|
return S_OK;
|
|
1023
888
|
}
|
|
1024
889
|
|
|
@@ -831,6 +831,30 @@ void ComponentView::updateAccessibilityProps(
|
|
|
831
831
|
oldViewProps.accessibilityValue.text,
|
|
832
832
|
newViewProps.accessibilityValue.text);
|
|
833
833
|
|
|
834
|
+
// Handle annotation properties with single call
|
|
835
|
+
winrt::Microsoft::ReactNative::implementation::UpdateUiaPropertiesForAnnotation(
|
|
836
|
+
EnsureUiaProvider(), oldViewProps.accessibilityAnnotation, newViewProps.accessibilityAnnotation);
|
|
837
|
+
|
|
838
|
+
// Handle expand/collapse state changes
|
|
839
|
+
if (oldViewProps.accessibilityState.has_value() != newViewProps.accessibilityState.has_value() ||
|
|
840
|
+
(oldViewProps.accessibilityState.has_value() && newViewProps.accessibilityState.has_value() &&
|
|
841
|
+
oldViewProps.accessibilityState->expanded != newViewProps.accessibilityState->expanded)) {
|
|
842
|
+
auto oldExpanded =
|
|
843
|
+
oldViewProps.accessibilityState.has_value() && oldViewProps.accessibilityState->expanded.has_value()
|
|
844
|
+
? oldViewProps.accessibilityState->expanded.value()
|
|
845
|
+
: false;
|
|
846
|
+
auto newExpanded =
|
|
847
|
+
newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->expanded.has_value()
|
|
848
|
+
? newViewProps.accessibilityState->expanded.value()
|
|
849
|
+
: false;
|
|
850
|
+
|
|
851
|
+
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
852
|
+
EnsureUiaProvider(),
|
|
853
|
+
UIA_ExpandCollapseExpandCollapseStatePropertyId,
|
|
854
|
+
static_cast<int>(winrt::Microsoft::ReactNative::implementation::GetExpandCollapseState(oldExpanded)),
|
|
855
|
+
static_cast<int>(winrt::Microsoft::ReactNative::implementation::GetExpandCollapseState(newExpanded)));
|
|
856
|
+
}
|
|
857
|
+
|
|
834
858
|
if ((oldViewProps.accessibilityState.has_value() && oldViewProps.accessibilityState->selected.has_value()) !=
|
|
835
859
|
((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value()))) {
|
|
836
860
|
auto compProvider =
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
28
28
|
|
|
29
29
|
constexpr float c_scrollerLineDelta = 16.0f;
|
|
30
|
-
constexpr auto c_maxSnapPoints = 1000;
|
|
31
30
|
|
|
32
31
|
enum class ScrollbarHitRegion : int {
|
|
33
32
|
Unknown = -1,
|
|
@@ -741,15 +740,6 @@ void ScrollViewComponentView::updateBackgroundColor(const facebook::react::Share
|
|
|
741
740
|
}
|
|
742
741
|
}
|
|
743
742
|
|
|
744
|
-
winrt::Windows::Foundation::Collections::IVector<float> ScrollViewComponentView::CreateSnapToOffsets(
|
|
745
|
-
const std::vector<float> &offsets) {
|
|
746
|
-
auto snapToOffsets = winrt::single_threaded_vector<float>();
|
|
747
|
-
for (const auto &offset : offsets) {
|
|
748
|
-
snapToOffsets.Append(offset);
|
|
749
|
-
}
|
|
750
|
-
return snapToOffsets;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
743
|
void ScrollViewComponentView::updateProps(
|
|
754
744
|
facebook::react::Props::Shared const &props,
|
|
755
745
|
facebook::react::Props::Shared const &oldProps) noexcept {
|
|
@@ -818,13 +808,11 @@ void ScrollViewComponentView::updateProps(
|
|
|
818
808
|
|
|
819
809
|
if (oldViewProps.snapToStart != newViewProps.snapToStart || oldViewProps.snapToEnd != newViewProps.snapToEnd ||
|
|
820
810
|
oldViewProps.snapToOffsets != newViewProps.snapToOffsets) {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
const auto snapToOffsets = CreateSnapToOffsets(newViewProps.snapToOffsets);
|
|
825
|
-
m_scrollVisual.SetSnapPoints(
|
|
826
|
-
newViewProps.snapToStart, newViewProps.snapToEnd, snapToOffsets.GetView(), SnapAlignment::Center);
|
|
811
|
+
const auto snapToOffsets = winrt::single_threaded_vector<float>();
|
|
812
|
+
for (const auto &offset : newViewProps.snapToOffsets) {
|
|
813
|
+
snapToOffsets.Append(static_cast<float>(offset));
|
|
827
814
|
}
|
|
815
|
+
m_scrollVisual.SetSnapPoints(newViewProps.snapToStart, newViewProps.snapToEnd, snapToOffsets.GetView());
|
|
828
816
|
}
|
|
829
817
|
}
|
|
830
818
|
|
|
@@ -875,9 +863,6 @@ void ScrollViewComponentView::updateContentVisualSize() noexcept {
|
|
|
875
863
|
m_verticalScrollbarComponent->ContentSize(contentSize);
|
|
876
864
|
m_horizontalScrollbarComponent->ContentSize(contentSize);
|
|
877
865
|
m_scrollVisual.ContentSize(contentSize);
|
|
878
|
-
|
|
879
|
-
// Update snap points if snapToInterval is being used, as content size affects the number of snap points
|
|
880
|
-
updateSnapPoints();
|
|
881
866
|
}
|
|
882
867
|
|
|
883
868
|
void ScrollViewComponentView::prepareForRecycle() noexcept {}
|
|
@@ -1354,6 +1339,32 @@ winrt::Microsoft::ReactNative::Composition::Experimental::IVisual ScrollViewComp
|
|
|
1354
1339
|
}
|
|
1355
1340
|
});
|
|
1356
1341
|
|
|
1342
|
+
m_scrollMomentumBeginRevoker = m_scrollVisual.ScrollMomentumBegin(
|
|
1343
|
+
winrt::auto_revoke,
|
|
1344
|
+
[this](
|
|
1345
|
+
winrt::IInspectable const & /*sender*/,
|
|
1346
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs const &args) {
|
|
1347
|
+
auto eventEmitter = GetEventEmitter();
|
|
1348
|
+
if (eventEmitter) {
|
|
1349
|
+
auto scrollMetrics = getScrollMetrics(eventEmitter, args);
|
|
1350
|
+
std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(eventEmitter)
|
|
1351
|
+
->onMomentumScrollBegin(scrollMetrics);
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
|
|
1355
|
+
m_scrollMomentumEndRevoker = m_scrollVisual.ScrollMomentumEnd(
|
|
1356
|
+
winrt::auto_revoke,
|
|
1357
|
+
[this](
|
|
1358
|
+
winrt::IInspectable const & /*sender*/,
|
|
1359
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs const &args) {
|
|
1360
|
+
auto eventEmitter = GetEventEmitter();
|
|
1361
|
+
if (eventEmitter) {
|
|
1362
|
+
auto scrollMetrics = getScrollMetrics(eventEmitter, args);
|
|
1363
|
+
std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(eventEmitter)
|
|
1364
|
+
->onMomentumScrollEnd(scrollMetrics);
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1357
1368
|
return visual;
|
|
1358
1369
|
}
|
|
1359
1370
|
|
|
@@ -1450,50 +1461,4 @@ void ScrollViewComponentView::updateShowsVerticalScrollIndicator(bool value) noe
|
|
|
1450
1461
|
void ScrollViewComponentView::updateDecelerationRate(float value) noexcept {
|
|
1451
1462
|
m_scrollVisual.SetDecelerationRate({value, value, value});
|
|
1452
1463
|
}
|
|
1453
|
-
|
|
1454
|
-
SnapAlignment ScrollViewComponentView::convertSnapToAlignment(
|
|
1455
|
-
facebook::react::ScrollViewSnapToAlignment alignment) noexcept {
|
|
1456
|
-
switch (alignment) {
|
|
1457
|
-
case facebook::react::ScrollViewSnapToAlignment::Center:
|
|
1458
|
-
return SnapAlignment::Center;
|
|
1459
|
-
case facebook::react::ScrollViewSnapToAlignment::End:
|
|
1460
|
-
return SnapAlignment::End;
|
|
1461
|
-
case facebook::react::ScrollViewSnapToAlignment::Start:
|
|
1462
|
-
default:
|
|
1463
|
-
return SnapAlignment::Start;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
void ScrollViewComponentView::updateSnapPoints() noexcept {
|
|
1468
|
-
const auto &viewProps = *std::static_pointer_cast<const facebook::react::ScrollViewProps>(this->viewProps());
|
|
1469
|
-
const auto snapToOffsets = CreateSnapToOffsets(viewProps.snapToOffsets);
|
|
1470
|
-
// Typically used in combination with snapToAlignment and decelerationRate="fast"
|
|
1471
|
-
auto snapAlignment = SnapAlignment::Center;
|
|
1472
|
-
auto decelerationRate = viewProps.decelerationRate;
|
|
1473
|
-
|
|
1474
|
-
// snapToOffsets has priority over snapToInterval (matches React Native behavior)
|
|
1475
|
-
if (viewProps.snapToInterval > 0 && decelerationRate >= 0.99) {
|
|
1476
|
-
snapAlignment = convertSnapToAlignment(viewProps.snapToAlignment);
|
|
1477
|
-
// Generate snap points based on interval
|
|
1478
|
-
// Calculate the content size to determine how many intervals to create
|
|
1479
|
-
float contentLength = viewProps.horizontal
|
|
1480
|
-
? std::max(m_contentSize.width, m_layoutMetrics.frame.size.width) * m_layoutMetrics.pointScaleFactor
|
|
1481
|
-
: std::max(m_contentSize.height, m_layoutMetrics.frame.size.height) * m_layoutMetrics.pointScaleFactor;
|
|
1482
|
-
|
|
1483
|
-
float interval = static_cast<float>(viewProps.snapToInterval) * m_layoutMetrics.pointScaleFactor;
|
|
1484
|
-
|
|
1485
|
-
// Ensure we have a reasonable minimum interval to avoid infinite loops or excessive memory usage
|
|
1486
|
-
if (interval >= 1.0f && contentLength > 0) {
|
|
1487
|
-
// Generate offsets at each interval, but limit the number of snap points to avoid excessive memory usage
|
|
1488
|
-
int snapPointCount = 0;
|
|
1489
|
-
|
|
1490
|
-
for (float offset = 0; offset <= contentLength && snapPointCount < c_maxSnapPoints; offset += interval) {
|
|
1491
|
-
snapToOffsets.Append(offset);
|
|
1492
|
-
snapPointCount++;
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
m_scrollVisual.SetSnapPoints(viewProps.snapToStart, viewProps.snapToEnd, snapToOffsets.GetView(), snapAlignment);
|
|
1498
|
-
}
|
|
1499
1464
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
20
20
|
|
|
21
|
-
using namespace Microsoft::ReactNative::Composition::Experimental;
|
|
22
|
-
|
|
23
21
|
struct ScrollBarComponent;
|
|
24
22
|
|
|
25
23
|
struct ScrollViewComponentView : ScrollViewComponentViewT<ScrollViewComponentView, ViewComponentView> {
|
|
@@ -123,7 +121,6 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
|
|
|
123
121
|
private:
|
|
124
122
|
void updateDecelerationRate(float value) noexcept;
|
|
125
123
|
void updateContentVisualSize() noexcept;
|
|
126
|
-
void updateSnapPoints() noexcept;
|
|
127
124
|
bool scrollToEnd(bool animate) noexcept;
|
|
128
125
|
bool scrollToStart(bool animate) noexcept;
|
|
129
126
|
bool scrollDown(float delta, bool animate) noexcept;
|
|
@@ -137,8 +134,6 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
|
|
|
137
134
|
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollPositionChangedArgs const &args) noexcept;
|
|
138
135
|
void updateShowsHorizontalScrollIndicator(bool value) noexcept;
|
|
139
136
|
void updateShowsVerticalScrollIndicator(bool value) noexcept;
|
|
140
|
-
SnapAlignment convertSnapToAlignment(facebook::react::ScrollViewSnapToAlignment alignment) noexcept;
|
|
141
|
-
winrt::Windows::Foundation::Collections::IVector<float> CreateSnapToOffsets(const std::vector<float> &offsets);
|
|
142
137
|
|
|
143
138
|
facebook::react::Size m_contentSize;
|
|
144
139
|
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollVisual m_scrollVisual{nullptr};
|
|
@@ -148,9 +143,12 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
|
|
|
148
143
|
m_scrollPositionChangedRevoker{};
|
|
149
144
|
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollVisual::ScrollBeginDrag_revoker
|
|
150
145
|
m_scrollBeginDragRevoker{};
|
|
151
|
-
|
|
152
146
|
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollVisual::ScrollEndDrag_revoker
|
|
153
147
|
m_scrollEndDragRevoker{};
|
|
148
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollVisual::ScrollMomentumBegin_revoker
|
|
149
|
+
m_scrollMomentumBeginRevoker{};
|
|
150
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IScrollVisual::ScrollMomentumEnd_revoker
|
|
151
|
+
m_scrollMomentumEndRevoker{};
|
|
154
152
|
|
|
155
153
|
float m_zoomFactor{1.0f};
|
|
156
154
|
bool m_isScrollingFromInertia = false;
|
|
@@ -175,6 +175,15 @@ void UpdateUiaProperty(winrt::IInspectable provider, PROPERTYID propId, int oldV
|
|
|
175
175
|
UiaRaiseAutomationPropertyChangedEvent(spProviderSimple.get(), propId, CComVariant(oldValue), CComVariant(newValue));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
void UpdateUiaProperty(winrt::IInspectable provider, PROPERTYID propId, long oldValue, long newValue) noexcept {
|
|
179
|
+
auto spProviderSimple = provider.try_as<IRawElementProviderSimple>();
|
|
180
|
+
|
|
181
|
+
if (spProviderSimple == nullptr || oldValue == newValue || !WasUiaPropertyAdvised(spProviderSimple, propId))
|
|
182
|
+
return;
|
|
183
|
+
|
|
184
|
+
UiaRaiseAutomationPropertyChangedEvent(spProviderSimple.get(), propId, CComVariant(oldValue), CComVariant(newValue));
|
|
185
|
+
}
|
|
186
|
+
|
|
178
187
|
void UpdateUiaProperty(
|
|
179
188
|
winrt::IInspectable provider,
|
|
180
189
|
PROPERTYID propId,
|
|
@@ -199,6 +208,29 @@ void UpdateUiaProperty(
|
|
|
199
208
|
UpdateUiaProperty(provider, propId, oldData, newData);
|
|
200
209
|
}
|
|
201
210
|
|
|
211
|
+
void UpdateUiaPropertiesForAnnotation(
|
|
212
|
+
winrt::IInspectable provider,
|
|
213
|
+
const std::optional<facebook::react::AccessibilityAnnotation> &oldAnnotation,
|
|
214
|
+
const std::optional<facebook::react::AccessibilityAnnotation> &newAnnotation) noexcept {
|
|
215
|
+
// if no value fall back to a default value.
|
|
216
|
+
const auto &old_annotation = oldAnnotation.value_or(facebook::react::AccessibilityAnnotation());
|
|
217
|
+
const auto &new_annotation = newAnnotation.value_or(facebook::react::AccessibilityAnnotation());
|
|
218
|
+
|
|
219
|
+
// Update all annotation properties
|
|
220
|
+
UpdateUiaProperty(
|
|
221
|
+
provider,
|
|
222
|
+
UIA_AnnotationAnnotationTypeIdPropertyId,
|
|
223
|
+
GetAnnotationTypeId(old_annotation.typeID),
|
|
224
|
+
GetAnnotationTypeId(new_annotation.typeID));
|
|
225
|
+
|
|
226
|
+
UpdateUiaProperty(
|
|
227
|
+
provider, UIA_AnnotationAnnotationTypeNamePropertyId, old_annotation.typeName, new_annotation.typeName);
|
|
228
|
+
|
|
229
|
+
UpdateUiaProperty(provider, UIA_AnnotationAuthorPropertyId, old_annotation.author, new_annotation.author);
|
|
230
|
+
|
|
231
|
+
UpdateUiaProperty(provider, UIA_AnnotationDateTimePropertyId, old_annotation.dateTime, new_annotation.dateTime);
|
|
232
|
+
}
|
|
233
|
+
|
|
202
234
|
long GetLiveSetting(const std::string &liveRegion) noexcept {
|
|
203
235
|
if (liveRegion == "polite") {
|
|
204
236
|
return LiveSetting::Polite;
|
|
@@ -259,6 +291,190 @@ long GetAnnotationTypeId(const std::string &annotationType) noexcept {
|
|
|
259
291
|
return AnnotationType_Unknown;
|
|
260
292
|
}
|
|
261
293
|
|
|
294
|
+
long GetControlTypeFromString(const std::string &role) noexcept {
|
|
295
|
+
if (role == "adjustable") {
|
|
296
|
+
return UIA_SliderControlTypeId;
|
|
297
|
+
} else if (role == "group" || role == "search" || role == "radiogroup" || role == "timer" || role.empty()) {
|
|
298
|
+
return UIA_GroupControlTypeId;
|
|
299
|
+
} else if (role == "button" || role == "imagebutton" || role == "switch" || role == "togglebutton") {
|
|
300
|
+
return UIA_ButtonControlTypeId;
|
|
301
|
+
} else if (role == "checkbox") {
|
|
302
|
+
return UIA_CheckBoxControlTypeId;
|
|
303
|
+
} else if (role == "combobox") {
|
|
304
|
+
return UIA_ComboBoxControlTypeId;
|
|
305
|
+
} else if (role == "alert" || role == "header" || role == "summary" || role == "text") {
|
|
306
|
+
return UIA_TextControlTypeId;
|
|
307
|
+
} else if (role == "image") {
|
|
308
|
+
return UIA_ImageControlTypeId;
|
|
309
|
+
} else if (role == "keyboardkey") {
|
|
310
|
+
return UIA_CustomControlTypeId;
|
|
311
|
+
} else if (role == "link") {
|
|
312
|
+
return UIA_HyperlinkControlTypeId;
|
|
313
|
+
}
|
|
314
|
+
// list and listitem were added by RNW to better support UIA Control Types
|
|
315
|
+
else if (role == "list") {
|
|
316
|
+
return UIA_ListControlTypeId;
|
|
317
|
+
} else if (role == "listitem") {
|
|
318
|
+
return UIA_ListItemControlTypeId;
|
|
319
|
+
} else if (role == "menu") {
|
|
320
|
+
return UIA_MenuControlTypeId;
|
|
321
|
+
} else if (role == "menubar") {
|
|
322
|
+
return UIA_MenuBarControlTypeId;
|
|
323
|
+
} else if (role == "menuitem") {
|
|
324
|
+
return UIA_MenuItemControlTypeId;
|
|
325
|
+
}
|
|
326
|
+
// If role is "none", remove the element from the control tree
|
|
327
|
+
// and expose it as a plain element would in the raw tree.
|
|
328
|
+
else if (role == "none") {
|
|
329
|
+
return UIA_GroupControlTypeId;
|
|
330
|
+
} else if (role == "progressbar") {
|
|
331
|
+
return UIA_ProgressBarControlTypeId;
|
|
332
|
+
} else if (role == "radio") {
|
|
333
|
+
return UIA_RadioButtonControlTypeId;
|
|
334
|
+
} else if (role == "scrollbar") {
|
|
335
|
+
return UIA_ScrollBarControlTypeId;
|
|
336
|
+
} else if (role == "spinbutton") {
|
|
337
|
+
return UIA_SpinnerControlTypeId;
|
|
338
|
+
} else if (role == "splitbutton") {
|
|
339
|
+
return UIA_SplitButtonControlTypeId;
|
|
340
|
+
} else if (role == "tab") {
|
|
341
|
+
return UIA_TabItemControlTypeId;
|
|
342
|
+
} else if (role == "tablist") {
|
|
343
|
+
return UIA_TabControlTypeId;
|
|
344
|
+
} else if (role == "textinput" || role == "searchbox") {
|
|
345
|
+
return UIA_EditControlTypeId;
|
|
346
|
+
} else if (role == "toolbar") {
|
|
347
|
+
return UIA_ToolBarControlTypeId;
|
|
348
|
+
} else if (role == "tree") {
|
|
349
|
+
return UIA_TreeControlTypeId;
|
|
350
|
+
} else if (role == "treeitem") {
|
|
351
|
+
return UIA_TreeItemControlTypeId;
|
|
352
|
+
} else if (role == "pane") {
|
|
353
|
+
return UIA_PaneControlTypeId;
|
|
354
|
+
}
|
|
355
|
+
assert(false);
|
|
356
|
+
return UIA_GroupControlTypeId;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
long GetControlTypeFromRole(const facebook::react::Role &role) noexcept {
|
|
360
|
+
switch (role) {
|
|
361
|
+
case facebook::react::Role::Alert:
|
|
362
|
+
return UIA_TextControlTypeId;
|
|
363
|
+
case facebook::react::Role::Application:
|
|
364
|
+
return UIA_WindowControlTypeId;
|
|
365
|
+
case facebook::react::Role::Button:
|
|
366
|
+
return UIA_ButtonControlTypeId;
|
|
367
|
+
case facebook::react::Role::Checkbox:
|
|
368
|
+
return UIA_CheckBoxControlTypeId;
|
|
369
|
+
case facebook::react::Role::Columnheader:
|
|
370
|
+
return UIA_HeaderControlTypeId;
|
|
371
|
+
case facebook::react::Role::Combobox:
|
|
372
|
+
return UIA_ComboBoxControlTypeId;
|
|
373
|
+
case facebook::react::Role::Document:
|
|
374
|
+
return UIA_DocumentControlTypeId;
|
|
375
|
+
case facebook::react::Role::Grid:
|
|
376
|
+
return UIA_GroupControlTypeId;
|
|
377
|
+
case facebook::react::Role::Group:
|
|
378
|
+
return UIA_GroupControlTypeId;
|
|
379
|
+
case facebook::react::Role::Heading:
|
|
380
|
+
return UIA_TextControlTypeId;
|
|
381
|
+
case facebook::react::Role::Img:
|
|
382
|
+
return UIA_ImageControlTypeId;
|
|
383
|
+
case facebook::react::Role::Link:
|
|
384
|
+
return UIA_HyperlinkControlTypeId;
|
|
385
|
+
case facebook::react::Role::List:
|
|
386
|
+
return UIA_ListControlTypeId;
|
|
387
|
+
case facebook::react::Role::Listitem:
|
|
388
|
+
return UIA_ListItemControlTypeId;
|
|
389
|
+
case facebook::react::Role::Menu:
|
|
390
|
+
return UIA_MenuControlTypeId;
|
|
391
|
+
case facebook::react::Role::Menubar:
|
|
392
|
+
return UIA_MenuBarControlTypeId;
|
|
393
|
+
case facebook::react::Role::Menuitem:
|
|
394
|
+
return UIA_MenuItemControlTypeId;
|
|
395
|
+
case facebook::react::Role::None:
|
|
396
|
+
return UIA_GroupControlTypeId;
|
|
397
|
+
case facebook::react::Role::Presentation:
|
|
398
|
+
return UIA_GroupControlTypeId;
|
|
399
|
+
case facebook::react::Role::Progressbar:
|
|
400
|
+
return UIA_ProgressBarControlTypeId;
|
|
401
|
+
case facebook::react::Role::Radio:
|
|
402
|
+
return UIA_RadioButtonControlTypeId;
|
|
403
|
+
case facebook::react::Role::Radiogroup:
|
|
404
|
+
return UIA_GroupControlTypeId;
|
|
405
|
+
case facebook::react::Role::Rowgroup:
|
|
406
|
+
return UIA_GroupControlTypeId;
|
|
407
|
+
case facebook::react::Role::Rowheader:
|
|
408
|
+
return UIA_HeaderControlTypeId;
|
|
409
|
+
case facebook::react::Role::Scrollbar:
|
|
410
|
+
return UIA_ScrollBarControlTypeId;
|
|
411
|
+
case facebook::react::Role::Searchbox:
|
|
412
|
+
return UIA_EditControlTypeId;
|
|
413
|
+
case facebook::react::Role::Separator:
|
|
414
|
+
return UIA_SeparatorControlTypeId;
|
|
415
|
+
case facebook::react::Role::Slider:
|
|
416
|
+
return UIA_SliderControlTypeId;
|
|
417
|
+
case facebook::react::Role::Spinbutton:
|
|
418
|
+
return UIA_SpinnerControlTypeId;
|
|
419
|
+
case facebook::react::Role::Status:
|
|
420
|
+
return UIA_StatusBarControlTypeId;
|
|
421
|
+
case facebook::react::Role::Summary:
|
|
422
|
+
return UIA_GroupControlTypeId;
|
|
423
|
+
case facebook::react::Role::Switch:
|
|
424
|
+
return UIA_ButtonControlTypeId;
|
|
425
|
+
case facebook::react::Role::Tab:
|
|
426
|
+
return UIA_TabItemControlTypeId;
|
|
427
|
+
case facebook::react::Role::Table:
|
|
428
|
+
return UIA_TableControlTypeId;
|
|
429
|
+
case facebook::react::Role::Tablist:
|
|
430
|
+
return UIA_TabControlTypeId;
|
|
431
|
+
case facebook::react::Role::Tabpanel:
|
|
432
|
+
return UIA_TabControlTypeId;
|
|
433
|
+
case facebook::react::Role::Timer:
|
|
434
|
+
return UIA_ButtonControlTypeId;
|
|
435
|
+
case facebook::react::Role::Toolbar:
|
|
436
|
+
return UIA_ToolBarControlTypeId;
|
|
437
|
+
case facebook::react::Role::Tooltip:
|
|
438
|
+
return UIA_ToolTipControlTypeId;
|
|
439
|
+
case facebook::react::Role::Tree:
|
|
440
|
+
return UIA_TreeControlTypeId;
|
|
441
|
+
case facebook::react::Role::Treegrid:
|
|
442
|
+
return UIA_TreeControlTypeId;
|
|
443
|
+
case facebook::react::Role::Treeitem:
|
|
444
|
+
return UIA_TreeItemControlTypeId;
|
|
445
|
+
}
|
|
446
|
+
return UIA_GroupControlTypeId;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
long GetHeadingLevel(int headingLevel, const std::string &strRole, const facebook::react::Role &role) noexcept {
|
|
450
|
+
if (strRole != "header" && role != facebook::react::Role::Heading) {
|
|
451
|
+
return HeadingLevel_None;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
switch (headingLevel) {
|
|
455
|
+
case 1:
|
|
456
|
+
return HeadingLevel1;
|
|
457
|
+
case 2:
|
|
458
|
+
return HeadingLevel2;
|
|
459
|
+
case 3:
|
|
460
|
+
return HeadingLevel3;
|
|
461
|
+
case 4:
|
|
462
|
+
return HeadingLevel4;
|
|
463
|
+
case 5:
|
|
464
|
+
return HeadingLevel5;
|
|
465
|
+
case 6:
|
|
466
|
+
return HeadingLevel6;
|
|
467
|
+
case 7:
|
|
468
|
+
return HeadingLevel7;
|
|
469
|
+
case 8:
|
|
470
|
+
return HeadingLevel8;
|
|
471
|
+
case 9:
|
|
472
|
+
return HeadingLevel9;
|
|
473
|
+
default:
|
|
474
|
+
return HeadingLevel_None;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
262
478
|
bool accessibilityAnnotationHasValue(
|
|
263
479
|
const std::optional<facebook::react::AccessibilityAnnotation> &annotation) noexcept {
|
|
264
480
|
return annotation.has_value() &&
|
|
@@ -35,6 +35,12 @@ void UpdateUiaProperty(
|
|
|
35
35
|
int oldValue,
|
|
36
36
|
int newValue) noexcept;
|
|
37
37
|
|
|
38
|
+
void UpdateUiaProperty(
|
|
39
|
+
winrt::Windows::Foundation::IInspectable provider,
|
|
40
|
+
PROPERTYID propId,
|
|
41
|
+
long oldValue,
|
|
42
|
+
long newValue) noexcept;
|
|
43
|
+
|
|
38
44
|
void UpdateUiaProperty(
|
|
39
45
|
winrt::Windows::Foundation::IInspectable provider,
|
|
40
46
|
PROPERTYID propId,
|
|
@@ -47,10 +53,21 @@ void UpdateUiaProperty(
|
|
|
47
53
|
const std::optional<std::string> &oldValue,
|
|
48
54
|
const std::optional<std::string> &newValue) noexcept;
|
|
49
55
|
|
|
56
|
+
void UpdateUiaPropertiesForAnnotation(
|
|
57
|
+
winrt::Windows::Foundation::IInspectable provider,
|
|
58
|
+
const std::optional<facebook::react::AccessibilityAnnotation> &oldAnnotation,
|
|
59
|
+
const std::optional<facebook::react::AccessibilityAnnotation> &newAnnotation) noexcept;
|
|
60
|
+
|
|
50
61
|
long GetLiveSetting(const std::string &liveRegion) noexcept;
|
|
51
62
|
|
|
52
63
|
long GetAnnotationTypeId(const std::string &annotationType) noexcept;
|
|
53
64
|
|
|
65
|
+
long GetControlTypeFromRole(const facebook::react::Role &role) noexcept;
|
|
66
|
+
|
|
67
|
+
long GetControlTypeFromString(const std::string &role) noexcept;
|
|
68
|
+
|
|
69
|
+
long GetHeadingLevel(int headingLevel, const std::string &strRole, const facebook::react::Role &role) noexcept;
|
|
70
|
+
|
|
54
71
|
bool accessibilityAnnotationHasValue(
|
|
55
72
|
const std::optional<facebook::react::AccessibilityAnnotation> &annotation) noexcept;
|
|
56
73
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.80.0-preview.
|
|
13
|
+
<ReactNativeWindowsVersion>0.80.0-preview.9</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>80</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>1b026c07b5e6f8a4ce73164aed620e4199567f22</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.80.0-preview.
|
|
3
|
+
"version": "0.80.0-preview.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@react-native-community/cli": "17.0.0",
|
|
27
27
|
"@react-native-community/cli-platform-android": "17.0.0",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "17.0.0",
|
|
29
|
-
"@react-native-windows/cli": "0.80.0-preview.
|
|
29
|
+
"@react-native-windows/cli": "0.80.0-preview.7",
|
|
30
30
|
"@react-native/assets": "1.0.0",
|
|
31
31
|
"@react-native/assets-registry": "0.80.0",
|
|
32
32
|
"@react-native/codegen": "0.80.0",
|