Skip to content

Commit

Permalink
review comment changes to add comment for blur
Browse files Browse the repository at this point in the history
  • Loading branch information
alokhyland committed Jan 10, 2025
1 parent 1868c38 commit 3aede04
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/nuxeo-path-suggestion/nuxeo-path-suggestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,11 @@ import { FormatBehavior } from '../nuxeo-format-behavior.js';
if (this.autoValidate) {
this.validate();
const typeHeadInput = this.$.typeahead.shadowRoot.querySelector('input');
// In order for setSelectionRange to function properly,
// it must become focused after the user has finished choosing a value from the list;
// in this instance, the input field becomes focused after the user has chosen the value.
typeHeadInput.blur();
const inputLength = typeHeadInput.value.length;
const inputLength = typeHeadInput && typeHeadInput.value && typeHeadInput.value.length;
typeHeadInput.setSelectionRange(inputLength, inputLength);
typeHeadInput.focus();
}
Expand Down

0 comments on commit 3aede04

Please sign in to comment.