diff --git a/src/vaadin-grid-pro-edit-column.html b/src/vaadin-grid-pro-edit-column.html
index 0461fb5..cac3b29 100644
--- a/src/vaadin-grid-pro-edit-column.html
+++ b/src/vaadin-grid-pro-edit-column.html
@@ -321,8 +321,8 @@
/** @private */
_removeEditor(cell, model) {
if (cell.__savedTemplate) {
- this._stampTemplateToCell(cell, cell.__savedTemplate, model);
cell._renderer = undefined;
+ this._stampTemplateToCell(cell, cell.__savedTemplate, model);
cell.__savedTemplate = undefined;
} else if (cell.__savedRenderer) {
this._stampRendererToCell(cell, cell.__savedRenderer, model);
diff --git a/test/edit-column-template.html b/test/edit-column-template.html
index d3e192f..88a8022 100644
--- a/test/edit-column-template.html
+++ b/test/edit-column-template.html
@@ -140,6 +140,19 @@
expect(getCellEditor(cell)).to.be.not.ok;
expect(cell._content.textContent).to.equal(old);
});
+
+ it('should restore template and remove editor when editing stopped after selection', () => {
+ const old = cell._content.textContent;
+ enter(cell);
+ grid.selectItem(grid.items[0]);
+ // Emulating stop editing with focusout
+ getCellEditor(cell).dispatchEvent(new CustomEvent('focusout', {bubbles: true, composed: true}));
+ grid._flushStopEdit();
+ expect(cell._renderer).to.be.not.ok;
+ expect(cell._template).to.equal(column._bodyTemplate);
+ expect(getCellEditor(cell)).to.be.not.ok;
+ expect(cell._content.textContent).to.equal(old);
+ });
});
describe('custom edit mode template', () => {