primefaces / primefaces/primereact

MultiSelect: onBlur event mismatch

Open
#2,833 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

The component's event "onBlur" is fired on, not only when focus is lost.

Reproducer

https://codesandbox.io/s/objective-wind-13w45j?file=/src/App.jsx:448-459

PrimeReact version

7.2.1

React version

17.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

1a. click on the MultiSelect to show the list of options
2a. pick any option
3a. onBlur event will increase counter above

1b. click on the MultiSelect to show the list of options and then click on filter input or "select all" checkbox
2b. onBlur event will increase counter above

Expected behavior

The onBlur event should to be triggered only when then component as a whole will lost the focus.

So it shouldn't be triggered during options selection nor filtering, but only when user will click (on|to) some(thing|where) else.

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 linked CodeSandbox reproducer and the MultiSelect component's focus and blur behavior. Verify that selecting an option, using the filter input, and clicking the select-all checkbox do not count as leaving the component, while clicking elsewhere does. Done means the onBlur event matches this expected behavior and the existing behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.