Skip to content

Commit

Permalink
refactor: extract input selection logic from editor focus
Browse files Browse the repository at this point in the history
  • Loading branch information
ugur-vaadin committed Mar 27, 2024
1 parent 1c27e3b commit 558ae39
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/grid-pro/src/vaadin-grid-pro-edit-column-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ export const GridProEditColumnMixin = (superClass) =>
editor.focus();
if (this.editorType === 'checkbox') {
editor.setAttribute('focus-ring', '');
} else if (editor instanceof HTMLInputElement) {
}
}

/** @private */
_selectEditorInput(editor) {
if (editor instanceof HTMLInputElement) {
editor.select();
} else if (editor.focusElement && editor.focusElement instanceof HTMLInputElement) {
editor.focusElement.select();
Expand Down Expand Up @@ -275,9 +280,10 @@ export const GridProEditColumnMixin = (superClass) =>
requestAnimationFrame(() => {
if (editInitiatorChar) {
this._setEditorValue(editor, editInitiatorChar);
editor.focus();
this._focusEditor(editor);
} else {
this._focusEditor(editor);
this._selectEditorInput(editor);
}
});
}
Expand Down

0 comments on commit 558ae39

Please sign in to comment.