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

fix: do not dispatch cell-focus on mouse up outside of cell #3587

Merged
merged 5 commits into from
Mar 23, 2022

Conversation

sissbruecker
Copy link
Contributor

Description

Fixes a workaround in Chrome for the cell-focus event, where a mouse up event outside of the grid could trigger a cell focus event from a cell. The fix involves checking if the mouse up event occured on the same cell as the mouse down event.

Fixes vaadin/flow-components#2863

Type of change

  • Bugfix

@@ -685,13 +685,16 @@ class Grid extends ElementMixin(
// focusable slot wrapper, that is why cells are not focused with
// mousedown. Workaround: listen for mousedown and focus manually.
cellContent.addEventListener('mousedown', () => {
if (window.chrome) {
if (isChrome) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous check did not work properly in tests with headless Chrome.

packages/grid/test/keyboard-navigation.test.js Outdated Show resolved Hide resolved
packages/grid/src/vaadin-grid.js Outdated Show resolved Hide resolved
packages/grid/test/keyboard-navigation.test.js Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Mar 23, 2022

Kudos, SonarCloud Quality Gate passed!    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

@sissbruecker sissbruecker merged commit 380da50 into master Mar 23, 2022
@sissbruecker sissbruecker deleted the fix/cell_focus_on_mouse_up branch March 23, 2022 09:06
vaadin-bot pushed a commit that referenced this pull request Mar 23, 2022
* fix: do not dispatch cell-focus on mouse up outside of cell

* import chrome check from test helpers

* address review comments

* add test for clicking on cell content child

* refactor to skip whole suite
vaadin-bot pushed a commit that referenced this pull request Mar 23, 2022
* fix: do not dispatch cell-focus on mouse up outside of cell

* import chrome check from test helpers

* address review comments

* add test for clicking on cell content child

* refactor to skip whole suite
sissbruecker added a commit that referenced this pull request Mar 23, 2022
…3593)

* fix: do not dispatch cell-focus on mouse up outside of cell

* import chrome check from test helpers

* address review comments

* add test for clicking on cell content child

* refactor to skip whole suite

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
sissbruecker added a commit that referenced this pull request Mar 23, 2022
…3594)

* fix: do not dispatch cell-focus on mouse up outside of cell

* import chrome check from test helpers

* address review comments

* add test for clicking on cell content child

* refactor to skip whole suite

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

This ticket/PR has been released with Vaadin 23.1.0.alpha1 and is also targeting the upcoming stable 23.1.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CellFocusEvent is triggered when dragging a grid row.
3 participants