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

Do not call onConfirmRow when Enter is pressed in DataTable row children #1574

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Jun 4, 2024

This PR fixes a bug where elements that can be interacted with Enter key would stop the event propagation when rendered inside a DataTable row, via renderItem.

wrapper.find('tbody tr a').first().simulate('keydown', { key: 'Enter' });

assert.notCalled(onConfirmRow);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails without the changes introduced in DataTable, while the test above keeps passing.

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7c15e79) to head (4d9d82b).

Current head 4d9d82b differs from pull request most recent head 6b4785e

Please upload reports for the commit 6b4785e to get more accurate results.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1574   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           62        62           
  Lines         1041      1041           
  Branches       397       397           
=========================================
  Hits          1041      1041           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya requested a review from robertknight June 4, 2024 09:48
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks sensible, but I think the comment could do a better job of explaining the why rather than what of the logic.

src/components/data/DataTable.tsx Outdated Show resolved Hide resolved
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks sensible, but I think the comment could do a better job of explaining the why rather than what of the logic.

@acelaya acelaya force-pushed the fix-data-table-enter-handler branch from 4d9d82b to 6b4785e Compare June 4, 2024 10:21
@acelaya acelaya merged commit d9578c9 into main Jun 4, 2024
2 checks passed
@acelaya acelaya deleted the fix-data-table-enter-handler branch June 4, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants