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: onCellEditComplete() called after form's onSubmit() #6019

Closed
inad9300 opened this issue Feb 20, 2024 · 3 comments · Fixed by #6641
Closed

DataTable: onCellEditComplete() called after form's onSubmit() #6019

inad9300 opened this issue Feb 20, 2024 · 3 comments · Fixed by #6641
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@inad9300
Copy link
Contributor

Describe the bug

When hitting "Enter" to complete a cell's edition, if the table is inside a form, the form is submitted before onCellEditComplete() is called, leaving no opportunity to prevent form submission through event.stopPropagation(). This is likely due to onCellEditComplete() being wrapped with setTimeout(), I wonder why:

setTimeout(() => onCellEditComplete(params));

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

No response

Expected behavior

No response

@inad9300 inad9300 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 20, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 20, 2024
@melloware
Copy link
Member

@inad9300 its because of this ticket: #5556

@inad9300
Copy link
Contributor Author

During my tests, I found a second problem: the enter key of the numeric keypad is not taken into account. This is because its "code" is "NumpadEnter", not "Enter". The "key" field should probably be used instead, as its value is "Enter" both for the regular and the numpad enter keys. There might be more places in the codebase with this issue.

As for my main problem, I still don't know how to circumvent the fact that my table is inside a form and cell editing needs to be independent from form submission, particularly given the setTimeout() that is in place. Any suggestions?

This might be seen as related to #3977. I believe it could be regarded as the same underlying problem: events at one layer trickle down to other layers that should not be affected.

@melloware
Copy link
Member

Its not related to #3977 the idea is the same but the implementation and fix is totally different. Can you open a new ticket for NumpadEnter as that is also a different issue than this original issue of the setTimeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants