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 event on stopedit when editor loading #8232

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export const InlineEditingMixin = (superClass) =>
}
const { cell, column, model } = this.__edited;

if (!shouldCancel) {
if (!shouldCancel && !this.hasAttribute('loading-editor')) {
const editor = column._getEditorComponent(cell);
if (editor) {
const value = column._getEditorValue(editor);
Expand Down
37 changes: 36 additions & 1 deletion packages/grid-pro/test/keyboard-navigation.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import { aTimeout, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';
import {
Expand Down Expand Up @@ -352,5 +352,40 @@ describe('keyboard navigation', () => {
await sendKeys({ press: 'Escape' });
expect(getContainerCellContent(grid.$.items, 0, 0).textContent).to.equal('0 foo');
});

it('should not fire event when tabbed through cells with slow editor', async () => {
const itemPropertyChangedSpy = sinon.spy();
grid.addEventListener('item-property-changed', itemPropertyChangedSpy);

const column = grid.querySelector('vaadin-grid-pro-edit-column');

// Custom editor with delayed operations
column.editModeRenderer = (root, _, __) => {
if (!root.firstElementChild) {
const input = document.createElement('input');
let actualValue = '';
Object.defineProperty(input, 'value', {
async get() {
await aTimeout(100);
return actualValue;
},
async set(v) {
await aTimeout(100);
actualValue = v;
},
});
root.appendChild(input);
}
};

const firstCell = getContainerCell(grid.$.items, 0, 0);
dblclick(firstCell._content);

await sendKeys({ press: 'Tab' });
await sendKeys({ press: 'Tab' });
await nextFrame();

expect(itemPropertyChangedSpy.called).to.be.false;
});
});
});