Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: issue with grid when grid table body is clicked and enter key is hit #2146

Merged
merged 3 commits into from
Jun 23, 2021

Conversation

hdamr
Copy link
Contributor

@hdamr hdamr commented Jun 22, 2021

This PR solves the issue with the grid when the table body of the grid is clicked and enter key is hit, the error shows when no row of the table is selected, Or as in the mentioned in the issue when a row is clicked and empty area of the table is selected and enter key is hit.

Fixes: vaadin/flow-components#1011

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@hdamr hdamr requested a review from DiegoCardoso June 22, 2021 08:33
cell: path[tableIndex - 3]
rowGroup: tableIndex >= 3 ? path[tableIndex - 1] : null,
row: tableIndex >= 3 ? path[tableIndex - 2] : null,
cell: tableIndex >= 3 ? path[tableIndex - 3] : null
Copy link
Contributor

Choose a reason for hiding this comment

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

tableIndex >= 3 is repeated 3 times. Could improve this by extracting it into a variable which would also make the code more readable, because the name of the variable indicates why in this case there is no cell/row/rowGroup.

@hdamr hdamr marked this pull request as ready for review June 23, 2021 09:27
@DiegoCardoso DiegoCardoso changed the title fix issue with grid when grid table body is clicked and enter key is hit fix: issue with grid when grid table body is clicked and enter key is hit Jun 23, 2021
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@hdamr hdamr merged commit cf9ef53 into master Jun 23, 2021
@hdamr hdamr deleted the fix-1011 branch June 23, 2021 12:55
vaadin-bot pushed a commit that referenced this pull request Jun 23, 2021
… hit (#2146)

* fix: it should not throw error when grid table body has focus and enter key is hit

* extract comparison into a separate variable

* Refactor to merge _parseEventPath and _getGridCellFocusLocation into a general _getGridLocation

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
hdamr added a commit that referenced this pull request Jun 28, 2021
… hit (#2146) (#2155)

* fix: it should not throw error when grid table body has focus and enter key is hit

* extract comparison into a separate variable

* Refactor to merge _parseEventPath and _getGridCellFocusLocation into a general _getGridLocation

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>

Co-authored-by: Hadi Amiri <84700249+hadivaadin@users.noreply.github.com>
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot read property '_content' of undefined when clicking outside a row in a grid and pressing enter
3 participants