primefaces / primefaces/primereact

ListBox: metaKeySelection={true} doesn't work

Open
#6,085 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

In the lastest version (10.5.1) the metaKeySelection default type is changed as false in some component (see https://github.com/primefaces/primereact/issues/5956).
However, in the ListBox component, the attribut metaKeySelection (set as true) doesn't work anymore. We can select multiple element from the list with simple clicks, without pressing any metakeys.

Reproducer

No response

PrimeReact version

10.5.1

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

Create a standard ListBox component with the attribut "multiple" and "metaKeySelection={true}"

https://stackblitz.com/edit/nqeuji?file=src%2FApp.jsx

Expected behavior

When I set the attributs multiple and metaKeySelection={true} clicking on an element, without pressing a metakey, replace the previous selection. My chosen element is not add to the selection but become the only one element selected.

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 ListBox component and reproduce the behavior using the linked StackBlitz example with multiple and metaKeySelection={true}. Verify the selection logic for clicks with and without a metakey, and consider the issue done when an unmodified click replaces the previous selection while metakey clicks preserve multiple selections.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
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.