From 54a76b80363e9b5f5b8a8a5f78f186be7e54f35c Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Fri, 27 Jun 2025 16:15:36 -0700 Subject: [PATCH] Fix keyboard navigation if snapToAlignment is set Summary: There is an issue with keyboard navigation if some scroll view sets `snapToAlignment`. In this case, we are unable to find potential focus candidates clipping is enabled since this prop will make it so that certain views in the hierarchy under the scroll view form a native view without any traits being set. The fix we have in place relies on `FormsStackingContext` to be set so it will break in this case. To fix this, we just return the entire ancestor list, since native will know how to deal with the cases that are not actual views, and in general has the official knowledge of what can be in the hierarchy or not. Changelog: [Internal] Differential Revision: D77467933 --- .../src/main/jni/react/fabric/FabricUIManagerBinding.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp index c277077031c..9f4bcf31dff 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp @@ -281,10 +281,7 @@ jintArray FabricUIManagerBinding::getRelativeAncestorList( for (auto it = std::next(ancestorList.begin()); it != ancestorList.end(); ++it) { auto& ancestor = *it; - if (ancestor.first.get().getTraits().check( - ShadowNodeTraits::Trait::FormsStackingContext)) { - ancestorTags.push_back(ancestor.first.get().getTag()); - } + ancestorTags.push_back(ancestor.first.get().getTag()); } jintArray result = env->NewIntArray(static_cast(ancestorTags.size()));