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: wait for editor focusout on Tab to get updated value #7822

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

web-padawan
Copy link
Member

@web-padawan web-padawan commented Sep 19, 2024

Description

Part of #7796

Fixes #7108

Updated the logic on Tab to not call event.preventDefault() and move focus synchronously as this doesn't handle the case when custom editor component is updating its value on blur (this is how e.g. vaadin-date-picker works).

Instead, we now let the browser handle the Tab key press so that the focusout event is caused by that, and wait for it to be fired (unless the event is from vaadin-select-overlay in which case we still handle it manually).

Note, the focus is still moved to the next cell by the logic in _switchEditCell() after the focusout so the keyboard navigation works as expected. I had to update tests from tab() helper to use sendKeys() to verify this fix.

Also added the integration test for custom editor using vaadin-date-picker (could reuse that later to also cover the second part of the issue, which is about value not updated on overlay closing - that would be a separate PR).

UPD: also added the integration test using vaadin-combo-box which was also affected by the issue with Tab.

Type of change

  • Bugfix

@@ -1,3 +1,4 @@
import './not-animated-styles.js';
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we have "select column" tests in this suite, I though it would be good to disable select animation.

Comment on lines +309 to +312
// Ignore focusout from internal tab event
if (this.__cancelCellSwitch) {
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously the flag was only checked on keydown in _switchEditCell method. However, now when we wait for the native focusout it is necessary to also check it here, otherwise the debouncer will stop editing.

@web-padawan web-padawan marked this pull request as ready for review September 19, 2024 12:35
Copy link

sonarcloud bot commented Sep 19, 2024

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.

Tab key press not committing editing component updates to the row model
1 participant