[0.85] Tab focus crashes the app (std::terminate in BorderPrimitive) when the focus-visual host has a backgroundColor; please backport #16386 to 0.85-stable
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 64/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cpp, react-native
- Área
- desktop-dev
Línea de trabajo
El fix ya está en main como #16386 (commit ba65c6b486) y solo toca el constructor BorderPrimitive(ComponentView &outer) en BorderPrimitive.cpp, estableciendo m_ownsRootVisual(true). Empieza leyendo ese commit contra la copia 0.85-stable del archivo y luego hazle cherry-pick a la rama 0.85-stable en lugar de volver a derivar el cambio. Compila el proyecto nativo de Windows y ejecuta la reproducción del foco con Tab del issue (un View con backgroundColor que envuelve dos TextInputs) para confirmar que el crash ya no ocurre. Hecho significa que un PR de backport se ha fusionado en 0.85-stable y está en cola para un release 0.85.x.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem Description
On 0.85.0 (New Architecture, lifted composition), pressing Tab to move keyboard focus terminates the app whenever the view that hosts the focus visual has a backgroundColor. Debug builds show "abort() has been called". Release builds die with 0xc0000409 (FAST_FAIL_FATAL_APP_EXIT) in ucrtbase!abort.
This is already fixed on main by #16386 ("Fix crash modifying outline property"). That PR gives the owning BorderPrimitive constructor m_ownsRootVisual(true). The fix is not on 0.85-stable, and 0.85.0 is the only 0.85 release on npm, so every 0.85 app still has the crash. Could #16386 be backported to 0.85-stable and shipped in a 0.85.x release?
Why it crashes: BorderPrimitive(ComponentView &outer) creates its own empty root sprite but leaves m_ownsRootVisual at its default of false. When TryUpdateSpecialBorderLayers creates its layers, it inserts them at m_outer->borderInsertAtIndex() + i. Since 0.85 that value is 1 whenever the owner has a m_backgroundVisual. So the first layer is inserted at index 1 into a sprite with 0 children, and CompVisualImpl::InsertAt hits if (index > m_childrenCache.size()) std::terminate();.
This constructor is used for the focus visual's inner and outer primitives (hostFocusVisual) and for m_outlinePrimitive. Two ways to trigger it:
- Tab focus: a pointer click focuses the same control without drawing a focus visual, so clicking never crashes. Tab does.
- Outline: a view that has both
backgroundColorand anoutline*style crashes the same way.
Stack, from a Release dump (no PDB for our CI build, so the RNW frames are identified by disassembly against the 0.85.0 source):
ucrtbase!abort
ucrtbase!terminate
Microsoft.ReactNative CompVisualImpl::InsertAt // index 1 > m_childrenCache.size() 0
Microsoft.ReactNative consume_..._IVisual<IVisual>::InsertAt // __FUNCSIG__ string in the thunk
Microsoft.ReactNative BorderPrimitive::TryUpdateSpecialBorderLayers // test m_ownsRootVisual; setne (m_outer->m_backgroundVisual != null)
Microsoft.ReactNative BorderPrimitive::finalize
Microsoft.ReactNative ComponentView::hostFocusVisual
Microsoft.ReactNative ComponentView::onGotFocus
Microsoft.ReactNative RootComponentView::SetFocusedComponent
Microsoft.ReactNative RootComponentView::TrySetFocusedComponent
Microsoft.ReactNative TryMoveFocus lambda
Microsoft.ReactNative walkTree (x4)
Microsoft.ReactNative RootComponentView::TryMoveFocus
Microsoft.ReactNative CompositionEventHandler::onKeyDown
Microsoft.UI.Input KeyboardInputWinRT::OnKeyDownEvent_Callback
Steps To Reproduce
- Create a 0.85.0 New Architecture app (lifted composition).
- Render a container with a background around two focusable controls:
<View style={{ flex: 1, backgroundColor: '#ffffff', padding: 24 }}> <TextInput placeholder="first" /> <TextInput placeholder="second" /> </View> - Click into the first input, then press Tab.
Expected Results
Focus moves to the second input and the focus visual is drawn. Instead the app terminates.
Removing the container's backgroundColor, or setting enableFocusRing={false} on the inputs, avoids the crash. Applying #16386's one-line change to BorderPrimitive.cpp in a source build fixes it.
CLI version
20.1.0
Environment
- react-native 0.85.3
- react-native-windows 0.85.0
- react 19.2.3
- Windows 11 (build 26300), x64
- Windows App SDK 1.8.260508005
Community Modules
Not relevant: the crash is entirely inside Microsoft.ReactNative.
Target React Native Architecture
New Architecture (WinAppSDK) Only
Target Platform Version
10.0.26100
Visual Studio Version
Visual Studio 2026
Build Configuration
Debug and Release (Release fails fast, Debug aborts)
Snack, code example, screenshot, or link to a repository
The snippet in Steps To Reproduce. Fix already on main: #16386 (commit ba65c6b486).
- Lenguaje dominante
- C++
- Estrellas
- 17.4k
- Forks
- 1.2k
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 37
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/react-native-windows
-
Fabric text is drawn with ClearType onto transparent composition surfaces, fringing thin glyphsAbiertoNeeds: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microsoft/react-native-windows#16340 ·
Los mantenedores suelen responder en 1 día
-
bug Needs: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/react-native-windows#16321 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Integration Follow-up Needs: Triage :mag:
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
microsoft/react-native-windows#16522 ·
Los mantenedores suelen responder en 1 día
-
bug Needs: Triage :mag:
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
microsoft/react-native-windows#16479 ·
Los mantenedores suelen responder en 1 día
-
Needs: Triage :mag:
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
microsoft/react-native-windows#16442 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/react-native-windows
Issues similares
-
bug priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
chipsalliance/verible#2644 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
grafana/pyroscope-dotnet#470 ·
Los mantenedores suelen responder en 1 día
-
documentation P5 XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
open-astro/AlpacaBridge#1848 ·
Los mantenedores suelen responder en 1 día
-
DiskANN AnnIterator returns unconverted IP distances after the graph walk runs out of candidatesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
zilliztech/knowhere#1933 ·
Los mantenedores suelen responder en 1 día