Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[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

Open Beginner friendly
#16,527 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-2 days
Newbie friendliness
64/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, react-native
Domain
desktop-dev

Research direction

The fix is already on main as #16386 (commit ba65c6b486) and only touches the BorderPrimitive(ComponentView &outer) constructor in BorderPrimitive.cpp, setting m_ownsRootVisual(true). Start by reading that commit against the 0.85-stable copy of the file, then cherry-pick it onto the 0.85-stable branch rather than re-deriving the change. Build the Windows native project and run the Tab-focus repro from the issue (a View with backgroundColor wrapping two TextInputs) to confirm the crash is gone. Done means a backport PR merged to 0.85-stable and queued for a 0.85.x release.

Written by the indexing model from the issue text.

Description

Needs: Triage :mag:
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 backgroundColor and an outline* 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
  1. Create a 0.85.0 New Architecture app (lifted composition).
  2. 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>
    
  3. 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).

Dominant language
C++
Stars
17.4k
Forks
1.2k
Avg merge
1d 20h
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/react-native-windows

All issues in microsoft/react-native-windows

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.