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

This issue has been created 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-09-27
Star Count 195296
Watcher Count 6655
Fork Count 40431
Issue Count 1113

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
HCOM Autocomplete drives me nuts! 8 2021-01-22 2022-08-13
Change Color of Dialogue-Btn-Close? 7 2019-11-26 2022-05-09
[QUESTION] E1810Controller support as media controller 2 2022-09-09 2022-09-13
[QUESTION] Help needed debug, Unexpected error running initialize() 2 2022-09-12 2022-09-13
Library & Topic Pages: Track user preference for Card vs List views 1 2022-04-20 2022-08-16
Different scores between online tool and Node package 6 2020-08-04 2022-09-02
Check for Brotli compression 2 2019-02-16 2022-09-02
validateExpiryDate always returns false on iOS 2 2021-08-11 2022-05-30
Payment Sheet Failed 13 2021-07-31 2022-04-27
Config for Livox Tele-15 1 2021-11-12 2022-09-12
Fresh install - issues with Office 365 integration 13 2022-02-10 2022-07-20
Plugin uses deprecated screen_icon function 2 2021-03-22 2022-09-06
[FR]: Article filters Help 8 2022-04-06 2022-09-02
Action Required: Fix Renovate Configuration 0 2021-10-19 2022-06-21
scaling factor for eigenmode adjoint source 1 2022-05-16 2022-09-02
Y-axis and bubble card is cut off on top 2 2022-04-26 2022-09-09
Punishment Hex is debuffing the player character instead 0 2021-03-13 2022-09-08
assert mimetype is not None 0 2022-04-05 2022-08-14
chore: Make packages/medusa/src/services/totals.js pass linting 5 2021-10-12 2022-08-31
Update ignore action API response 2 2021-10-25 2022-09-24
Jupyter file (.ipynb) display's BUG. 1 2021-07-20 2022-09-12
DefaultAzureIdentity .. need ability to specify options for development/VS 3 2020-04-02 2022-05-14
item.export entry point need librayID 3 2021-11-23 2022-07-23
problem with DNS resolution? 2 2021-01-14 2022-07-21
Import map diagnostics: - Invalid top-level key "hash". Only "imports" and "scopes" can be present. 2 2021-04-15 2022-08-12
minor bug: "No scripts available" doesn't occur on an empty file 3 2021-04-22 2022-08-12
pre-commit hook fails in fish shell 5 2021-07-23 2022-08-12
Make sure search shows up with blog posts 0 2021-10-11 2022-07-04
Test handling of type reference types in different compiler phases and add more tests where required 1 2021-12-01 2022-07-29
/usr/share/nginx/html/{{ v.imageurl }}" failed (2: No such file or directory) error from videos-web app 2 2021-03-04 2022-09-15
tamrieltradecentre.com 4 2022-05-29 2022-09-12
Json schema validation from resource proto 1 2019-06-26 2022-09-17
ErrorTrader: Poloniex error 422: . Amount must be at least 0.000001 2 2021-03-21 2022-08-24
`actions.edit_command_line` does not remap colon 4 2021-09-08 2022-09-17
remove assert statement in run_vcpu() function in vcpu.c 1 2022-02-22 2022-07-23
Consider pipeline dop for broadcast join cost computation 0 2021-12-16 2022-09-02
Add io.buildpacks.buildpack.layers label to distribution spec 0 2021-05-19 2022-09-13
[vue2/3]<style lang="postcss"> 5 2021-10-28 2022-09-06
Base Docker image does not auto-update 1 2021-08-05 2022-09-25
Rendering issue 1 2017-11-20 2022-01-11
No validation of cached downloaded files 5 2021-11-01 2022-09-17
support for the fabric token-sdk 0 2021-06-08 2022-09-02
Bindgen outputs should be checked in. 1 2022-02-02 2022-09-11
Multiple brackets do not work sometimes 1 2022-04-11 2022-08-22
[ERROR] DOCKER> IO Error while requesting logs: 1 2021-07-16 2022-08-03
MUC nick registration allows registering unlimited nicks 2 2021-05-21 2022-08-17
toset() ignored in for_each statement 2 2022-02-01 2022-09-17
request help: 5 2021-04-19 2022-01-22
Migration 0.66 Android error compilation - Hermes error - 1 2021-10-05 2022-09-06
Text is rendered incorrectly when using `RTL` text with `LTR` Directionality 1 2021-10-18 2022-09-12