react / react/react

No blur event fired when button is disabled/removed

Open
#9,142 23 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: DOM Type: Bug
Dominant language
JavaScript
Stars
251k
Forks
51.4k
Avg merge
2d 4h
Merged PRs (30d)
53

Description

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When a focussed button becomes disabled, React does not dispatch a blur event.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/reactjs/69z2wepo/).

  1. Attach a blur event to a button
  2. Focus the button
  3. Make the button disabled or remove it from the DOM

What is the expected behavior?
A blur event will be dispatched.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
15.1.0, not sure if it worked in previous versions.

Isolated test case: http://jsbin.com/fuvite/1/edit?html,css,js,output

Contributor guide

Open the contributing guide

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.

Research direction

Start with the isolated test case at http://jsbin.com/fuvite/1/edit and reproduce the behavior using React 15.1.0. Check the focus and blur handling for a button that is disabled or removed after gaining focus. Done means the expected blur event is dispatched in both scenarios, with regression coverage for the reported steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.