primefaces / primefaces/primereact

DataTable - Frozen rows + CellSelection:"single" - when selecting a cell, two are highlighted

Open
#8,277 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

DataTable - Frozen rows + CellSelection:"single" when we click and selecting one cell, two are highlighted, one from frozen column, another from value in dataTable

DataTable props:
<DataTable
value={customers}
frozenValue={lockedCustomers}
cellSelection
selectionMode="single"
selection={selectedCell}
onSelectionChange={(e) => setSelectedCell(e.value)}
scrollable
scrollHeight="400px"
tableStyle={{ minWidth: '50rem' }}
dataKey="id"
>

Image

Test sandbox
https://stackblitz.com/edit/o1ch7jx7?file=src%2FApp.jsx

Reproducer

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

System Information
"primereact": "latest",
"react": "18.3.1",
Steps to reproduce the behavior

-In Datatable with frozen rows + cellSelection single click on frozen cell
-Frozen cel is highlited
-First "not frozen" cell is also higlited

Expected behavior

Single cell should be highlighted

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 StackBlitz reproducer and its src/App.jsx to confirm the duplicate highlight when selecting a frozen cell. Then locate the DataTable implementation handling frozen rows and cellSelection, and verify the fix by confirming that only the selected cell is highlighted in the reproducer.

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.