Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: focus issue on cell editors #6800

Open
MBelniak opened this issue Jun 27, 2024 · 0 comments
Open

DataTable: focus issue on cell editors #6800

MBelniak opened this issue Jun 27, 2024 · 0 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@MBelniak
Copy link
Contributor

Describe the bug

I use 'editor' prop on a column which renders a text input when in an edition mode. Whenever the change in input causes a rerender of my DataTable (e.g. by udpating my custom context I'm using for whatever reason), the input loses focus - the Save icon steals the focus.

I've finally found the culprit: https://github.com/primefaces/primereact/blob/master/components/lib/datatable/BodyCell.js#L230
For some reason this function is called on every rerender when we are in the edit mode. When I comment out the body of this fn, the text input no longer loses focus and everything works nice.

I want to understand what is the reasoning behind adding such logic and if it's ok to add/use a props (e.g. selectionAutoFocus) to disable this behavior.

If you need a repro, I will create one shortly.

Reproducer

No response

PrimeReact version

10.5.1

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@MBelniak MBelniak added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant