react-native-windows 0.0.0-canary.950 → 0.0.0-canary.951

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.
Files changed (61) hide show
  1. package/Directory.Build.props +1 -1
  2. package/Libraries/Components/View/ViewAccessibility.d.ts +48 -1
  3. package/Libraries/NativeComponent/BaseViewConfig.windows.js +1 -0
  4. package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +4 -25
  5. package/Microsoft.ReactNative/AsynchronousEventBeat.h +0 -3
  6. package/Microsoft.ReactNative/{JSDispatcherWriter.cpp → CallInvokerWriter.cpp} +58 -56
  7. package/Microsoft.ReactNative/{JSDispatcherWriter.h → CallInvokerWriter.h} +9 -8
  8. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +100 -0
  9. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +31 -0
  10. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +12 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +1 -0
  12. package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +0 -2
  13. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +0 -1
  14. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +7 -0
  15. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +58 -0
  16. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +5 -0
  17. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +0 -1
  18. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/CompositionAccessibilityProps.h +67 -0
  19. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +5 -0
  20. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +2 -0
  21. package/Microsoft.ReactNative/JsiApi.cpp +8 -0
  22. package/Microsoft.ReactNative/JsiApi.h +1 -0
  23. package/Microsoft.ReactNative/JsiApi.idl +1 -0
  24. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
  25. package/Microsoft.ReactNative/QuirkSettings.cpp +0 -16
  26. package/Microsoft.ReactNative/QuirkSettings.h +0 -3
  27. package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +11 -1
  28. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +66 -61
  29. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -1
  30. package/Microsoft.ReactNative/TurboModulesProvider.cpp +12 -12
  31. package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +37 -31
  32. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +1 -0
  33. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +2 -0
  34. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +1 -1
  35. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +13 -6
  36. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +7 -6
  37. package/Microsoft.ReactNative.Cxx/JSI/decorator.h +220 -0
  38. package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +28 -0
  39. package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +6 -0
  40. package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +241 -4
  41. package/Microsoft.ReactNative.Cxx/JSI/jsi.h +207 -19
  42. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +2 -2
  43. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +1267 -614
  44. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +4 -2
  45. package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +81 -20
  46. package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +47 -2
  47. package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +13 -0
  48. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  49. package/PropertySheets/JSEngine.props +1 -1
  50. package/PropertySheets/React.Cpp.props +1 -1
  51. package/ReactCommon/cgmanifest.json +1 -1
  52. package/Shared/HermesRuntimeHolder.cpp +6 -0
  53. package/Shared/JSI/ChakraRuntime.cpp +4 -0
  54. package/Shared/JSI/ChakraRuntime.h +2 -0
  55. package/Shared/Shared.vcxitems +5 -6
  56. package/Shared/Shared.vcxitems.filters +4 -1
  57. package/Shared/TurboModuleManager.cpp +0 -15
  58. package/index.windows.js +4 -2
  59. package/package.json +1 -1
  60. package/Microsoft.ReactNative/SynchronousEventBeat.cpp +0 -51
  61. package/Microsoft.ReactNative/SynchronousEventBeat.h +0 -31
@@ -26,7 +26,7 @@
26
26
  <FmtVersion>10.1.0</FmtVersion>
27
27
  <FmtCommitHash>ca2e3685b160617d3d95fcd9e789c4e06ca88</FmtCommitHash>
28
28
  <!-- Commit hash for https://github.com/microsoft/node-api-jsi code. -->
29
- <NodeApiJsiCommitHash>83cfef428a97627c9185c73da097e42742de56eb</NodeApiJsiCommitHash>
29
+ <NodeApiJsiCommitHash>980cb60d7911237d0f647fc566543ef627adac70</NodeApiJsiCommitHash>
30
30
  </PropertyGroup>
31
31
 
32
32
  <!--
@@ -13,7 +13,8 @@ import {NativeSyntheticEvent} from '../../Types/CoreEventTypes';
13
13
  * @see https://reactnative.dev/docs/accessibility#accessibility-properties
14
14
  */
15
15
  export interface AccessibilityProps
16
- extends AccessibilityPropsAndroid,
16
+ extends AccessibilityPropsWindows,
17
+ AccessibilityPropsAndroid,
17
18
  AccessibilityPropsIOS {
18
19
  /**
19
20
  * When true, indicates that the view is an accessibility element.
@@ -258,6 +259,52 @@ export type AccessibilityRole =
258
259
  | 'listitem' // Windows
259
260
  | 'toolbar';
260
261
 
262
+ // [Windows]
263
+ export type AnnotationType =
264
+ | 'AdvanceProofingIssue'
265
+ | 'Author'
266
+ | 'CircularReferenceError'
267
+ | 'Comment'
268
+ | 'ConflictingChange'
269
+ | 'DataValidationError'
270
+ | 'DeletionChange'
271
+ | 'EditingLockedChange'
272
+ | 'Endnote'
273
+ | 'ExternalChange'
274
+ | 'Footer'
275
+ | 'Footnote'
276
+ | 'FormatChange'
277
+ | 'FormulaError'
278
+ | 'GrammarError'
279
+ | 'Header'
280
+ | 'Highlighted'
281
+ | 'InsertionChange'
282
+ | 'Mathematics'
283
+ | 'MoveChange'
284
+ | 'SpellingError'
285
+ | 'TrackChanges'
286
+ | 'Unknown'
287
+ | 'UnsyncedChange';
288
+
289
+ // [Windows]
290
+ export type AccessibilityAnnotationInfo = Readonly<{
291
+ typeID: AnnotationType;
292
+ typeName?: string;
293
+ author?: string;
294
+ dateTime?: string;
295
+ target?: string;
296
+ }>;
297
+ export interface AccessibilityPropsWindows {
298
+ /**
299
+ * Tells a person using a screen reader what kind of annotation they
300
+ * have selected. If available, it will also tell a person the author of the annotation and
301
+ * the date and time the annotation was posted.
302
+ *
303
+ * Note: If typeID is 'Unknown', a typeName must be provided.
304
+ */
305
+ accessibilityAnnotation?: AccessibilityAnnotationInfo; //Windows
306
+ }
307
+
261
308
  export interface AccessibilityPropsAndroid {
262
309
  /**
263
310
  * Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
@@ -371,6 +371,7 @@ const validAttributesForNonEventProps = {
371
371
  accessibilityLiveRegion: true, // [Windows]
372
372
  accessibilityPosInSet: true, // [Windows]
373
373
  accessibilitySetSize: true, // [Windows]
374
+ accessibilityAnnotation: true, // [Windows]
374
375
  disabled: true, // [Windows]
375
376
  focusable: true, // [Windows]
376
377
  keyDownEvents: true, // [Windows]
@@ -6,37 +6,16 @@ AsynchronousEventBeat::AsynchronousEventBeat(
6
6
  std::shared_ptr<facebook::react::EventBeat::OwnerBox> const ownerBox,
7
7
  const winrt::Microsoft::ReactNative::ReactContext &context,
8
8
  std::shared_ptr<facebook::react::RuntimeScheduler> runtimeScheduler)
9
- : EventBeat(ownerBox, *runtimeScheduler), m_context(context), m_runtimeScheduler(std::move(runtimeScheduler)) {}
10
-
11
- void AsynchronousEventBeat::induce() const {
12
- if (!isEventBeatRequested_ || m_isBeatCallbackScheduled) {
13
- isEventBeatRequested_ = false;
14
- return;
15
- }
16
- isEventBeatRequested_ = false;
17
- m_isBeatCallbackScheduled = true;
18
-
19
- facebook::react::RuntimeScheduler &schedulerRef = *m_runtimeScheduler.get();
20
- schedulerRef.scheduleWork([this, ownerBox = ownerBox_](facebook::jsi::Runtime &runtime) {
21
- auto owner = ownerBox->owner.lock();
22
- if (!owner) {
23
- return;
24
- }
25
-
26
- m_isBeatCallbackScheduled = false;
27
- if (beatCallback_) {
28
- beatCallback_(runtime);
29
- }
30
- });
31
- }
9
+ : EventBeat(ownerBox, *runtimeScheduler), m_context(context) {}
32
10
 
33
11
  void AsynchronousEventBeat::request() const {
34
12
  bool alreadyRequested = isEventBeatRequested_.exchange(true);
35
13
  if (!alreadyRequested) {
36
- if (m_context.UIDispatcher().HasThreadAccess()) {
14
+ auto uiDispatcher = m_context.UIDispatcher();
15
+ if (uiDispatcher.HasThreadAccess()) {
37
16
  induce();
38
17
  } else {
39
- m_context.UIDispatcher().Post([this, ownerBox = ownerBox_]() {
18
+ uiDispatcher.Post([this, ownerBox = ownerBox_]() {
40
19
  auto owner = ownerBox->owner.lock();
41
20
  if (!owner) {
42
21
  return;
@@ -11,13 +11,10 @@ class AsynchronousEventBeat final : public facebook::react::EventBeat {
11
11
  const winrt::Microsoft::ReactNative::ReactContext &context,
12
12
  std::shared_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
13
13
 
14
- void induce() const;
15
14
  void request() const override;
16
15
 
17
16
  private:
18
- mutable std::atomic<bool> m_isBeatCallbackScheduled{false};
19
17
  winrt::Microsoft::ReactNative::ReactContext m_context;
20
- std::shared_ptr<facebook::react::RuntimeScheduler> m_runtimeScheduler;
21
18
  };
22
19
 
23
20
  } // namespace Microsoft::ReactNative
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  #include "pch.h"
5
- #include "JSDispatcherWriter.h"
5
+ #include "CallInvokerWriter.h"
6
6
  #include <JSI/JSIDynamic.h>
7
7
  #include <crash/verifyElseCrash.h>
8
8
 
@@ -25,106 +25,108 @@ struct JSNoopWriter : winrt::implements<JSNoopWriter, IJSValueWriter> {
25
25
  };
26
26
 
27
27
  //===========================================================================
28
- // JSDispatcherWriter implementation
28
+ // CallInvokerWriter implementation
29
29
  //===========================================================================
30
30
 
31
- JSDispatcherWriter::JSDispatcherWriter(
32
- IReactDispatcher const &jsDispatcher,
31
+ CallInvokerWriter::CallInvokerWriter(
32
+ const std::shared_ptr<facebook::react::CallInvoker> &jsInvoker,
33
33
  std::weak_ptr<LongLivedJsiRuntime> jsiRuntimeHolder) noexcept
34
- : m_jsDispatcher(jsDispatcher), m_jsiRuntimeHolder(std::move(jsiRuntimeHolder)) {}
34
+ : m_callInvoker(jsInvoker), m_jsiRuntimeHolder(std::move(jsiRuntimeHolder)) {}
35
35
 
36
- JSDispatcherWriter::~JSDispatcherWriter() {
36
+ CallInvokerWriter::~CallInvokerWriter() {
37
37
  if (auto jsiRuntimeHolder = m_jsiRuntimeHolder.lock()) {
38
38
  jsiRuntimeHolder->allowRelease();
39
39
  }
40
40
  }
41
41
 
42
- void JSDispatcherWriter::WithResultArgs(
42
+ void CallInvokerWriter::WithResultArgs(
43
43
  Mso::Functor<void(facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t argCount)>
44
44
  handler) noexcept {
45
- if (m_jsDispatcher.HasThreadAccess()) {
46
- VerifyElseCrash(!m_dynamicWriter);
47
- if (auto jsiRuntimeHolder = m_jsiRuntimeHolder.lock()) {
48
- const facebook::jsi::Value *args{nullptr};
49
- size_t argCount{0};
50
- m_jsiWriter->AccessResultAsArgs(args, argCount);
51
- handler(jsiRuntimeHolder->Runtime(), args, argCount);
52
- m_jsiWriter = nullptr;
53
- }
54
- } else {
55
- VerifyElseCrash(!m_jsiWriter);
56
- folly::dynamic dynValue = m_dynamicWriter->TakeValue();
57
- VerifyElseCrash(dynValue.isArray());
58
- m_jsDispatcher.Post(
59
- [handler, dynValue = std::move(dynValue), weakJsiRuntimeHolder = m_jsiRuntimeHolder, self = get_strong()]() {
60
- if (auto jsiRuntimeHolder = weakJsiRuntimeHolder.lock()) {
61
- std::vector<facebook::jsi::Value> args;
62
- args.reserve(dynValue.size());
63
- auto &runtime = jsiRuntimeHolder->Runtime();
64
- for (auto const &item : dynValue) {
65
- args.emplace_back(facebook::jsi::valueFromDynamic(runtime, item));
66
- }
67
- handler(runtime, args.data(), args.size());
68
- }
69
- });
70
- }
45
+ /*
46
+ if (m_jsDispatcher.HasThreadAccess()) {
47
+ VerifyElseCrash(!m_dynamicWriter);
48
+ if (auto jsiRuntimeHolder = m_jsiRuntimeHolder.lock()) {
49
+ const facebook::jsi::Value *args{nullptr};
50
+ size_t argCount{0};
51
+ m_jsiWriter->AccessResultAsArgs(args, argCount);
52
+ handler(jsiRuntimeHolder->Runtime(), args, argCount);
53
+ m_jsiWriter = nullptr;
54
+ }
55
+ } else {
56
+ */
57
+ VerifyElseCrash(!m_jsiWriter);
58
+ folly::dynamic dynValue = m_dynamicWriter->TakeValue();
59
+ VerifyElseCrash(dynValue.isArray());
60
+ m_callInvoker->invokeAsync(
61
+ [handler, dynValue = std::move(dynValue), weakJsiRuntimeHolder = m_jsiRuntimeHolder, self = get_strong()](
62
+ facebook::jsi::Runtime &runtime) {
63
+ std::vector<facebook::jsi::Value> args;
64
+ args.reserve(dynValue.size());
65
+ for (auto const &item : dynValue) {
66
+ args.emplace_back(facebook::jsi::valueFromDynamic(runtime, item));
67
+ }
68
+ handler(runtime, args.data(), args.size());
69
+ });
70
+ //}
71
71
  }
72
72
 
73
- void JSDispatcherWriter::WriteNull() noexcept {
73
+ void CallInvokerWriter::WriteNull() noexcept {
74
74
  GetWriter().WriteNull();
75
75
  }
76
76
 
77
- void JSDispatcherWriter::WriteBoolean(bool value) noexcept {
77
+ void CallInvokerWriter::WriteBoolean(bool value) noexcept {
78
78
  GetWriter().WriteBoolean(value);
79
79
  }
80
80
 
81
- void JSDispatcherWriter::WriteInt64(int64_t value) noexcept {
81
+ void CallInvokerWriter::WriteInt64(int64_t value) noexcept {
82
82
  GetWriter().WriteInt64(value);
83
83
  }
84
84
 
85
- void JSDispatcherWriter::WriteDouble(double value) noexcept {
85
+ void CallInvokerWriter::WriteDouble(double value) noexcept {
86
86
  GetWriter().WriteDouble(value);
87
87
  }
88
88
 
89
- void JSDispatcherWriter::WriteString(const winrt::hstring &value) noexcept {
89
+ void CallInvokerWriter::WriteString(const winrt::hstring &value) noexcept {
90
90
  GetWriter().WriteString(value);
91
91
  }
92
92
 
93
- void JSDispatcherWriter::WriteObjectBegin() noexcept {
93
+ void CallInvokerWriter::WriteObjectBegin() noexcept {
94
94
  GetWriter().WriteObjectBegin();
95
95
  }
96
96
 
97
- void JSDispatcherWriter::WritePropertyName(const winrt::hstring &name) noexcept {
97
+ void CallInvokerWriter::WritePropertyName(const winrt::hstring &name) noexcept {
98
98
  GetWriter().WritePropertyName(name);
99
99
  }
100
100
 
101
- void JSDispatcherWriter::WriteObjectEnd() noexcept {
101
+ void CallInvokerWriter::WriteObjectEnd() noexcept {
102
102
  GetWriter().WriteObjectEnd();
103
103
  }
104
104
 
105
- void JSDispatcherWriter::WriteArrayBegin() noexcept {
105
+ void CallInvokerWriter::WriteArrayBegin() noexcept {
106
106
  GetWriter().WriteArrayBegin();
107
107
  }
108
108
 
109
- void JSDispatcherWriter::WriteArrayEnd() noexcept {
109
+ void CallInvokerWriter::WriteArrayEnd() noexcept {
110
110
  GetWriter().WriteArrayEnd();
111
111
  }
112
112
 
113
- IJSValueWriter JSDispatcherWriter::GetWriter() noexcept {
113
+ IJSValueWriter CallInvokerWriter::GetWriter() noexcept {
114
114
  if (!m_writer) {
115
- if (m_jsDispatcher.HasThreadAccess()) {
116
- if (auto jsiRuntimeHolder = m_jsiRuntimeHolder.lock()) {
117
- m_jsiWriter = winrt::make_self<JsiWriter>(jsiRuntimeHolder->Runtime());
118
- m_writer = m_jsiWriter.as<IJSValueWriter>();
119
- } else {
120
- m_writer = winrt::make<JSNoopWriter>();
121
- }
122
- } else {
123
- m_dynamicWriter = winrt::make_self<DynamicWriter>();
124
- m_writer = m_dynamicWriter.as<IJSValueWriter>();
125
- }
115
+ /*
116
+ if (m_jsDispatcher.HasThreadAccess()) {
117
+ if (auto jsiRuntimeHolder = m_jsiRuntimeHolder.lock()) {
118
+ m_jsiWriter = winrt::make_self<JsiWriter>(jsiRuntimeHolder->Runtime());
119
+ m_writer = m_jsiWriter.as<IJSValueWriter>();
120
+ } else {
121
+ m_writer = winrt::make<JSNoopWriter>();
122
+ }
123
+ } else {
124
+ */
125
+ m_dynamicWriter = winrt::make_self<DynamicWriter>();
126
+ m_writer = m_dynamicWriter.as<IJSValueWriter>();
127
+ //}
126
128
  }
127
- Debug(VerifyElseCrash(m_dynamicWriter != nullptr || m_jsDispatcher.HasThreadAccess()));
129
+ Debug(VerifyElseCrash(m_dynamicWriter != nullptr /* || m_jsDispatcher.HasThreadAccess()*/));
128
130
  return m_writer;
129
131
  }
130
132
 
@@ -3,6 +3,7 @@
3
3
  #pragma once
4
4
 
5
5
  #include <JSI/LongLivedJsiValue.h>
6
+ #include <ReactCommon/CallInvoker.h>
6
7
  #include <functional/functor.h>
7
8
  #include "DynamicWriter.h"
8
9
  #include "JsiWriter.h"
@@ -10,13 +11,13 @@
10
11
 
11
12
  namespace winrt::Microsoft::ReactNative {
12
13
 
13
- // IJSValueWriter to ensure that JsiWriter is always used from JSDispatcher.
14
- // In case if writing is done outside of JSDispatcher, it uses DynamicWriter to create
15
- // folly::dynamic which then is written to JsiWriter in JSDispatcher.
16
- struct JSDispatcherWriter : winrt::implements<JSDispatcherWriter, IJSValueWriter> {
17
- ~JSDispatcherWriter();
18
- JSDispatcherWriter(
19
- IReactDispatcher const &jsDispatcher,
14
+ // IJSValueWriter to ensure that JsiWriter is always used from a RuntimeExecutor.
15
+ // In case if writing is done outside of RuntimeExecutor, it uses DynamicWriter to create
16
+ // folly::dynamic which then is written to JsiWriter in RuntimeExecutor.
17
+ struct CallInvokerWriter : winrt::implements<CallInvokerWriter, IJSValueWriter> {
18
+ ~CallInvokerWriter();
19
+ CallInvokerWriter(
20
+ const std::shared_ptr<facebook::react::CallInvoker> &jsInvoker,
20
21
  std::weak_ptr<LongLivedJsiRuntime> jsiRuntimeHolder) noexcept;
21
22
  void WithResultArgs(Mso::Functor<void(facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t argCount)>
22
23
  handler) noexcept;
@@ -37,7 +38,7 @@ struct JSDispatcherWriter : winrt::implements<JSDispatcherWriter, IJSValueWriter
37
38
  IJSValueWriter GetWriter() noexcept;
38
39
 
39
40
  private:
40
- IReactDispatcher m_jsDispatcher;
41
+ const std::shared_ptr<facebook::react::CallInvoker> m_callInvoker;
41
42
  std::weak_ptr<LongLivedJsiRuntime> m_jsiRuntimeHolder;
42
43
  winrt::com_ptr<DynamicWriter> m_dynamicWriter;
43
44
  winrt::com_ptr<JsiWriter> m_jsiWriter;
@@ -0,0 +1,100 @@
1
+ #include "pch.h"
2
+ #include "CompositionAnnotationProvider.h"
3
+ #include <Fabric/ComponentView.h>
4
+ #include <Unicode.h>
5
+ #include "RootComponentView.h"
6
+ #include "UiaHelpers.h"
7
+
8
+ namespace winrt::Microsoft::ReactNative::implementation {
9
+
10
+ CompositionAnnotationProvider::CompositionAnnotationProvider(
11
+ const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
12
+ CompositionDynamicAutomationProvider *parentProvider) noexcept
13
+ : m_view{componentView} {
14
+ m_parentProvider.copy_from(parentProvider);
15
+ }
16
+ HRESULT __stdcall CompositionAnnotationProvider::get_AnnotationTypeId(int *retVal) {
17
+ if (retVal == nullptr)
18
+ return E_POINTER;
19
+ auto strongView = m_view.view();
20
+
21
+ if (!strongView)
22
+ return UIA_E_ELEMENTNOTAVAILABLE;
23
+
24
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
25
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
26
+ if (props == nullptr)
27
+ return UIA_E_ELEMENTNOTAVAILABLE;
28
+
29
+ if (props->accessibilityAnnotation.value().typeID.empty()) {
30
+ return E_FAIL;
31
+ }
32
+ *retVal = static_cast<int>(GetAnnotationTypeId(props->accessibilityAnnotation.value().typeID));
33
+ return S_OK;
34
+ }
35
+ HRESULT __stdcall CompositionAnnotationProvider::get_AnnotationTypeName(BSTR *retVal) {
36
+ if (retVal == nullptr)
37
+ return E_POINTER;
38
+ auto strongView = m_view.view();
39
+
40
+ if (!strongView)
41
+ return UIA_E_ELEMENTNOTAVAILABLE;
42
+
43
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
44
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
45
+ if (props == nullptr)
46
+ return UIA_E_ELEMENTNOTAVAILABLE;
47
+
48
+ if (props->accessibilityAnnotation.value().typeName.empty()) {
49
+ return E_FAIL;
50
+ }
51
+ auto typeName = ::Microsoft::Common::Unicode::Utf8ToUtf16(props->accessibilityAnnotation.value().typeName);
52
+ *retVal = SysAllocString(typeName.c_str());
53
+ return S_OK;
54
+ }
55
+ HRESULT __stdcall CompositionAnnotationProvider::get_Author(BSTR *retVal) {
56
+ if (retVal == nullptr)
57
+ return E_POINTER;
58
+ auto strongView = m_view.view();
59
+
60
+ if (!strongView)
61
+ return UIA_E_ELEMENTNOTAVAILABLE;
62
+
63
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
64
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
65
+ if (props == nullptr)
66
+ return UIA_E_ELEMENTNOTAVAILABLE;
67
+
68
+ if (props->accessibilityAnnotation.value().author.empty()) {
69
+ return E_FAIL;
70
+ }
71
+ auto author = ::Microsoft::Common::Unicode::Utf8ToUtf16(props->accessibilityAnnotation.value().author);
72
+ *retVal = SysAllocString(author.c_str());
73
+ return S_OK;
74
+ }
75
+ HRESULT __stdcall CompositionAnnotationProvider::get_DateTime(BSTR *retVal) {
76
+ if (retVal == nullptr)
77
+ return E_POINTER;
78
+ auto strongView = m_view.view();
79
+
80
+ if (!strongView)
81
+ return UIA_E_ELEMENTNOTAVAILABLE;
82
+
83
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
84
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
85
+ if (props == nullptr)
86
+ return UIA_E_ELEMENTNOTAVAILABLE;
87
+
88
+ if (props->accessibilityAnnotation.value().dateTime.empty()) {
89
+ return E_FAIL;
90
+ }
91
+ auto dateTime = ::Microsoft::Common::Unicode::Utf8ToUtf16(props->accessibilityAnnotation.value().dateTime);
92
+ *retVal = SysAllocString(dateTime.c_str());
93
+ return S_OK;
94
+ }
95
+
96
+ HRESULT __stdcall CompositionAnnotationProvider::get_Target(IRawElementProviderSimple **retVal) {
97
+ // no-opt
98
+ return E_NOTIMPL;
99
+ }
100
+ } // namespace winrt::Microsoft::ReactNative::implementation
@@ -0,0 +1,31 @@
1
+ #pragma once
2
+
3
+ #include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
4
+ #include <Fabric/Composition/CompositionViewComponentView.h>
5
+ #include <Fabric/ReactTaggedView.h>
6
+ #include <UIAutomation.h>
7
+ #include <inspectable.h>
8
+ #include <uiautomationcore.h>
9
+
10
+ namespace winrt::Microsoft::ReactNative::implementation {
11
+
12
+ class CompositionAnnotationProvider : public winrt::implements<CompositionAnnotationProvider, IAnnotationProvider> {
13
+ public:
14
+ CompositionAnnotationProvider(
15
+ const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
16
+ CompositionDynamicAutomationProvider *parentProvider) noexcept;
17
+
18
+ // inherited via IAnnotationProvider
19
+ virtual HRESULT __stdcall get_AnnotationTypeId(int *retVal) override;
20
+ virtual HRESULT __stdcall get_AnnotationTypeName(BSTR *retVal) override;
21
+ virtual HRESULT __stdcall get_Author(BSTR *retVal) override;
22
+ virtual HRESULT __stdcall get_DateTime(BSTR *retVal) override;
23
+ virtual HRESULT __stdcall get_Target(IRawElementProviderSimple **retVal) override;
24
+
25
+ private:
26
+ ::Microsoft::ReactNative::ReactTaggedView m_view;
27
+ winrt::com_ptr<IAnnotationProvider> m_annotationProvider;
28
+ winrt::com_ptr<CompositionDynamicAutomationProvider> m_parentProvider;
29
+ };
30
+
31
+ } // namespace winrt::Microsoft::ReactNative::implementation
@@ -1,6 +1,7 @@
1
1
  #include "pch.h"
2
2
  #include "CompositionDynamicAutomationProvider.h"
3
3
  #include <Fabric/ComponentView.h>
4
+ #include <Fabric/Composition/CompositionAnnotationProvider.h>
4
5
  #include <Fabric/Composition/CompositionTextRangeProvider.h>
5
6
  #include <Fabric/Composition/ParagraphComponentView.h>
6
7
  #include <Fabric/Composition/ScrollViewComponentView.h>
@@ -36,6 +37,12 @@ CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
36
37
  strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>(), this)
37
38
  .try_as<ITextProvider2>();
38
39
  }
40
+
41
+ if (strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>()) {
42
+ m_annotationProvider = winrt::make<CompositionAnnotationProvider>(
43
+ strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>(), this)
44
+ .try_as<IAnnotationProvider>();
45
+ }
39
46
  }
40
47
 
41
48
  CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
@@ -282,6 +289,11 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
282
289
  strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>()) {
283
290
  m_textProvider.as<IUnknown>().copy_to(pRetVal);
284
291
  }
292
+ if (patternId == UIA_AnnotationPatternId &&
293
+ strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>() &&
294
+ accessibilityAnnotationHasValue(props->accessibilityAnnotation)) {
295
+ m_annotationProvider.as<IUnknown>().copy_to(pRetVal);
296
+ }
285
297
 
286
298
  return S_OK;
287
299
  }
@@ -101,6 +101,7 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
101
101
  private:
102
102
  ::Microsoft::ReactNative::ReactTaggedView m_view;
103
103
  winrt::com_ptr<ITextProvider2> m_textProvider;
104
+ winrt::com_ptr<IAnnotationProvider> m_annotationProvider;
104
105
  std::vector<winrt::com_ptr<IRawElementProviderSimple>> m_selectionItems;
105
106
  // Non-null when this UIA node is the peer of a ContentIslandComponentView.
106
107
  winrt::Microsoft::UI::Content::ChildSiteLink m_childSiteLink{nullptr};
@@ -25,8 +25,6 @@ void CompositionUIService::SetCompositor(
25
25
  CompositionContextPropertyId(),
26
26
  winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::CreateContext(
27
27
  compositor));
28
- // Default to using Bridgeless mode when using fabric
29
- winrt::Microsoft::ReactNative::implementation::QuirkSettings::SetIsBridgeless(properties, !!compositor);
30
28
  }
31
29
 
32
30
  winrt::Microsoft::UI::Composition::Compositor CompositionUIService::GetCompositor(
@@ -231,7 +231,6 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
231
231
 
232
232
  m_popUp = winrt::Microsoft::UI::Content::DesktopPopupSiteBridge::Create(
233
233
  portal.Parent()
234
- .Parent()
235
234
  .as<winrt::Microsoft::ReactNative::Composition::ComponentView>()
236
235
  .Root()
237
236
  .ReactNativeIsland()
@@ -973,6 +973,10 @@ void WindowsTextInputComponentView::onLostFocus(
973
973
  LRESULT lresult;
974
974
  DrawBlock db(*this);
975
975
  m_textServices->TxSendMessage(WM_KILLFOCUS, 0, 0, &lresult);
976
+ if (windowsTextInputProps().selectTextOnFocus) {
977
+ LRESULT res;
978
+ m_textServices->TxSendMessage(EM_SETSEL, static_cast<WPARAM>(-1), static_cast<WPARAM>(-1), &res);
979
+ }
976
980
  }
977
981
  m_caretVisual.IsVisible(false);
978
982
 
@@ -1001,6 +1005,9 @@ void WindowsTextInputComponentView::onGotFocus(
1001
1005
 
1002
1006
  if (windowsTextInputProps().clearTextOnFocus) {
1003
1007
  m_textServices->TxSetText(L"");
1008
+ } else if (windowsTextInputProps().selectTextOnFocus) {
1009
+ LRESULT res;
1010
+ m_textServices->TxSendMessage(EM_SETSEL, static_cast<WPARAM>(0), static_cast<WPARAM>(-1), &res);
1004
1011
  }
1005
1012
  }
1006
1013
  }
@@ -189,6 +189,64 @@ long GetLiveSetting(const std::string &liveRegion) noexcept {
189
189
  return LiveSetting::Off;
190
190
  }
191
191
 
192
+ long GetAnnotationTypeId(const std::string &annotationType) noexcept {
193
+ if (annotationType == "Author") {
194
+ return AnnotationType_Author;
195
+ } else if (annotationType == "CircularReferenceError") {
196
+ return AnnotationType_CircularReferenceError;
197
+ } else if (annotationType == "Comment") {
198
+ return AnnotationType_Comment;
199
+ } else if (annotationType == "ConflictingChange") {
200
+ return AnnotationType_ConflictingChange;
201
+ } else if (annotationType == "DataValidationError") {
202
+ return AnnotationType_DataValidationError;
203
+ } else if (annotationType == "DeletionChange") {
204
+ return AnnotationType_DeletionChange;
205
+ } else if (annotationType == "EditingLockedChange") {
206
+ return AnnotationType_EditingLockedChange;
207
+ } else if (annotationType == "Endnote") {
208
+ return AnnotationType_Endnote;
209
+ } else if (annotationType == "ExternalChange") {
210
+ return AnnotationType_ExternalChange;
211
+ } else if (annotationType == "Footer") {
212
+ return AnnotationType_Footer;
213
+ } else if (annotationType == "Footnote") {
214
+ return AnnotationType_Footnote;
215
+ } else if (annotationType == "FormatChange") {
216
+ return AnnotationType_FormatChange;
217
+ } else if (annotationType == "FormulaError") {
218
+ return AnnotationType_FormulaError;
219
+ } else if (annotationType == "GrammarError") {
220
+ return AnnotationType_GrammarError;
221
+ } else if (annotationType == "Header") {
222
+ return AnnotationType_Header;
223
+ } else if (annotationType == "Highlighted") {
224
+ return AnnotationType_Highlighted;
225
+ } else if (annotationType == "InsertionChange") {
226
+ return AnnotationType_InsertionChange;
227
+ } else if (annotationType == "Mathematics") {
228
+ return AnnotationType_Mathematics;
229
+ } else if (annotationType == "MoveChange") {
230
+ return AnnotationType_MoveChange;
231
+ } else if (annotationType == "SpellingError") {
232
+ return AnnotationType_SpellingError;
233
+ } else if (annotationType == "TrackChanges") {
234
+ return AnnotationType_TrackChanges;
235
+ } else if (annotationType == "AdvanceProofingIssue") {
236
+ return AnnotationType_AdvancedProofingIssue;
237
+ } else if (annotationType == "UnsyncedChange") {
238
+ return AnnotationType_UnsyncedChange;
239
+ }
240
+ return AnnotationType_Unknown;
241
+ }
242
+
243
+ bool accessibilityAnnotationHasValue(
244
+ const std::optional<facebook::react::AccessibilityAnnotation> &annotation) noexcept {
245
+ return annotation.has_value() &&
246
+ !(annotation.value().typeID.empty() && annotation.value().typeName.empty() && annotation.value().author.empty() &&
247
+ annotation.value().dateTime.empty() && annotation.value().target.empty());
248
+ }
249
+
192
250
  void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept {
193
251
  auto strongView = view.view();
194
252
 
@@ -33,6 +33,11 @@ void UpdateUiaProperty(
33
33
 
34
34
  long GetLiveSetting(const std::string &liveRegion) noexcept;
35
35
 
36
+ long GetAnnotationTypeId(const std::string &annotationType) noexcept;
37
+
38
+ bool accessibilityAnnotationHasValue(
39
+ const std::optional<facebook::react::AccessibilityAnnotation> &annotation) noexcept;
40
+
36
41
  void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept;
37
42
 
38
43
  ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept;
@@ -19,7 +19,6 @@
19
19
  #include <JSI/jsi.h>
20
20
  #include <ReactCommon/RuntimeExecutor.h>
21
21
  #include <SchedulerSettings.h>
22
- #include <SynchronousEventBeat.h>
23
22
  #include <UI.Xaml.Controls.h>
24
23
  #include <react/components/rnwcore/ComponentDescriptors.h>
25
24
  #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>