Skip to content

fix: sync editor value to server when same value is typed again#9568

Merged
sissbruecker merged 3 commits into
mainfrom
fix/grid-pro-firefox-value-change
Jun 22, 2026
Merged

fix: sync editor value to server when same value is typed again#9568
sissbruecker merged 3 commits into
mainfrom
fix/grid-pro-firefox-value-change

Conversation

@sissbruecker

@sissbruecker sissbruecker commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Since a recent change, Firefox treats input fields that have the same value on blur as they had on focus as unchanged, even if the value was changed programmatically in between. This is problematic for custom editors in GridPro, where the value is set programmatically from the server after the client-side component has already focused the editor. If, after starting editing, a user types exactly the same value that the input had before the server updated the editor value, no change event is fired and the editor value is never synced to the server where it would be used to update the item data:

  • First edit:
    • User edits cell, types "foo", commits
    • "foo" is different from the value the editor had before focus (empty value), property is synced to the server
    • item-property-change fires, server detects change in the editor's value, item is updated on server
  • Second edit (same column, different cell)
    • User starts editing, web component focuses editor component immediately
    • Initially the client-side value is still "foo", the server only updates the editor's value once it receives the cell-edit-started event, which eventually results in a client-side update of the editor value, let's say to "bar"
    • User types "foo" again, commits
    • "foo" is not different from the value the editor had before focusing it, no change event is fired for the editor, it's value is not synced back to the server
    • item-property-change fires, server does not detect a change in the editor's value, no item update

This change addresses the issue by always firing a synthetic change event whenever an input element loses focus. The fix is scoped only Firefox, and only to custom editors. For built-in editors no such fix is needed as the edited value is applied by the web component before focusing. The change is not covered by tests, as the issue only manifests in Firefox whereas tests only run in Chrome.

Fixes #9437

Type of change

  • Bugfix

@sissbruecker
sissbruecker requested a review from vursen June 19, 2026 09:20
@sissbruecker
sissbruecker marked this pull request as draft June 19, 2026 11:43

window.Vaadin.Flow.gridProConnector = {
selectAll: (editor, itemKey, grid) => {
handleCustomEditorValueUpdate: (editor, itemKey, grid) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept this refactoring as it includes other logic than just selecting the value.

@sissbruecker
sissbruecker marked this pull request as ready for review June 22, 2026 08:56
@sonarqubecloud

Copy link
Copy Markdown

@sissbruecker
sissbruecker added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit f73dc7d Jun 22, 2026
17 checks passed
@sissbruecker
sissbruecker deleted the fix/grid-pro-firefox-value-change branch June 22, 2026 10:09
sissbruecker added a commit that referenced this pull request Jun 22, 2026
… (CP: 25.2) (#9572)

This PR cherry-picks changes from the original PR #9568 to branch 25.2.
---
#### Original PR description
> ## Description
> 
> Since a recent change, Firefox treats input fields that have the same
value on blur as they had on focus as unchanged, even if the value was
changed programmatically in between. This is problematic for custom
editors in GridPro, where the value is set programmatically from the
server after the client-side component has already focused the editor.
If, after starting editing, a user types exactly the same value that the
input had before the server updated the editor value, no change event is
fired and the editor value is never synced to the server where it would
be used to update the item data:
> - First edit:
>   - User edits cell, types "foo", commits
> - "foo" is different from the value the editor had before focus (empty
value), property is synced to the server
> - `item-property-change` fires, server detects change in the editor's
value, item is updated on server
> - Second edit (same column, different cell)
> - User starts editing, web component focuses editor component
immediately
> - Initially the client-side value is still "foo", the server only
updates the editor's value once it receives the `cell-edit-started`
event, which eventually results in a client-side update of the editor
value, let's say to "bar"
>   - User types "foo" again, commits
> - "foo" is not different from the value the editor had before focusing
it, no change event is fired for the editor, it's value is not synced
back to the server
> - `item-property-change` fires, server does not detect a change in the
editor's value, no item update
> 
> This change addresses the issue by always firing a synthetic change
event whenever an input element loses focus. The fix is scoped only
Firefox, and only to custom editors. For built-in editors no such fix is
needed as the edited value is applied by the web component before
focusing. The change is not covered by tests, as the issue only
manifests in Firefox whereas tests only run in Chrome.
> 
> Fixes #9437
> 
> ## Type of change
> 
> - Bugfix
>

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
sissbruecker added a commit that referenced this pull request Jun 22, 2026
… (CP: 25.1) (#9573)

This PR cherry-picks changes from the original PR #9568 to branch 25.1.
---
#### Original PR description
> ## Description
> 
> Since a recent change, Firefox treats input fields that have the same
value on blur as they had on focus as unchanged, even if the value was
changed programmatically in between. This is problematic for custom
editors in GridPro, where the value is set programmatically from the
server after the client-side component has already focused the editor.
If, after starting editing, a user types exactly the same value that the
input had before the server updated the editor value, no change event is
fired and the editor value is never synced to the server where it would
be used to update the item data:
> - First edit:
>   - User edits cell, types "foo", commits
> - "foo" is different from the value the editor had before focus (empty
value), property is synced to the server
> - `item-property-change` fires, server detects change in the editor's
value, item is updated on server
> - Second edit (same column, different cell)
> - User starts editing, web component focuses editor component
immediately
> - Initially the client-side value is still "foo", the server only
updates the editor's value once it receives the `cell-edit-started`
event, which eventually results in a client-side update of the editor
value, let's say to "bar"
>   - User types "foo" again, commits
> - "foo" is not different from the value the editor had before focusing
it, no change event is fired for the editor, it's value is not synced
back to the server
> - `item-property-change` fires, server does not detect a change in the
editor's value, no item update
> 
> This change addresses the issue by always firing a synthetic change
event whenever an input element loses focus. The fix is scoped only
Firefox, and only to custom editors. For built-in editors no such fix is
needed as the edited value is applied by the web component before
focusing. The change is not covered by tests, as the issue only
manifests in Firefox whereas tests only run in Chrome.
> 
> Fixes #9437
> 
> ## Type of change
> 
> - Bugfix
>

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
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.

GridPro: Custom editColumn does not register consecutive changes with same value

3 participants