Skip to content

Commit

Permalink
Fix crash when currently focused element gets marked as enableFocusRi…
Browse files Browse the repository at this point in the history
…ng=false (#14306)

* Fix crash when currently focused element gets marked as enableFocusRing=false

* Change files
  • Loading branch information
acoates-ms authored Jan 25, 2025
1 parent b438707 commit 47c5cd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fix crash when currently focused element gets marked as enableFocusRing=false",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,14 @@ void ComponentView::updateProps(
m_componentHostingFocusVisual->hostFocusVisual(false, get_strong());
}

if (m_componentHostingFocusVisual->m_focusPrimitive->m_focusInnerPrimitive) {
m_componentHostingFocusVisual->m_focusPrimitive->m_focusInnerPrimitive->updateProps(oldViewProps, newViewProps);
}
if (m_componentHostingFocusVisual->m_focusPrimitive->m_focusOuterPrimitive) {
m_componentHostingFocusVisual->m_focusPrimitive->m_focusOuterPrimitive->updateProps(oldViewProps, newViewProps);
// We have to check m_componentHostingFocusVisual again, as it can be set to null by above hostFocusVisual call
if (m_componentHostingFocusVisual) {
if (m_componentHostingFocusVisual->m_focusPrimitive->m_focusInnerPrimitive) {
m_componentHostingFocusVisual->m_focusPrimitive->m_focusInnerPrimitive->updateProps(oldViewProps, newViewProps);
}
if (m_componentHostingFocusVisual->m_focusPrimitive->m_focusOuterPrimitive) {
m_componentHostingFocusVisual->m_focusPrimitive->m_focusOuterPrimitive->updateProps(oldViewProps, newViewProps);
}
}
}
if ((m_flags & ComponentViewFeatures::ShadowProps) == ComponentViewFeatures::ShadowProps) {
Expand Down

0 comments on commit 47c5cd4

Please sign in to comment.