Bug: `onBlur` is not called when a focused element is unmounted

This issue has been tracked since 2022-09-06.

React version: 18.2.0

Steps To Reproduce

  1. Go to https://codesandbox.io/s/adoring-flower-xk881j?file=/src/App.js
  2. Click on the button
  3. Notice that there is no console output when the button is unmounted

Link to code example: https://codesandbox.io/s/adoring-flower-xk881j?file=/src/App.js

The current behavior

When a focused element is unmounted onBlur is never called.

The expected behavior

Using vanilla HTML+JS when a focused DOM element is removed, the blur event is called. Here is the example: https://codesandbox.io/s/youthful-ptolemy-o8ulop?file=/src/index.js

rothsandro wrote this answer on 2022-09-16

It works if you downgrade to React 18.0, see #25095

More Details About Repo
Owner Name facebook
Repo Name react
Full Name facebook/react
Language JavaScript
Created Date 2013-05-24
Updated Date 2022-10-03
Star Count 195560
Watcher Count 6648
Fork Count 40508
Issue Count 1111

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date