Skip to content

Commit d8d0e2f

Browse files
authored
Properly hook up root uia provider to island (#14643)
* Properly hook up root uia provider to island * Change files
1 parent 10017d2 commit d8d0e2f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Properly hook up root uia provider to island",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,12 @@ winrt::IInspectable ReactNativeIsland::GetUiaProvider() noexcept {
376376
if (m_uiaProvider == nullptr) {
377377
m_uiaProvider =
378378
winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider>(*this);
379-
if (m_hwnd && !m_island) {
379+
if (m_hwnd || m_island) {
380380
auto pRootProvider =
381381
static_cast<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider *>(
382382
m_uiaProvider.as<IRawElementProviderSimple>().get());
383383
if (pRootProvider != nullptr) {
384+
pRootProvider->SetIsland(m_island);
384385
pRootProvider->SetHwnd(m_hwnd);
385386
}
386387
}
@@ -875,14 +876,7 @@ winrt::Microsoft::UI::Content::ContentIsland ReactNativeIsland::Island() {
875876
winrt::Microsoft::UI::Content::ContentIsland const &,
876877
winrt::Microsoft::UI::Content::ContentIslandAutomationProviderRequestedEventArgs const &args) {
877878
if (auto pThis = weakThis.get()) {
878-
auto provider = pThis->GetUiaProvider();
879-
auto pRootProvider =
880-
static_cast<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider *>(
881-
provider.as<IRawElementProviderSimple>().get());
882-
if (pRootProvider != nullptr) {
883-
pRootProvider->SetIsland(pThis->m_island);
884-
}
885-
args.AutomationProvider(std::move(provider));
879+
args.AutomationProvider(pThis->GetUiaProvider());
886880
args.Handled(true);
887881
}
888882
});

0 commit comments

Comments
 (0)