site: adjust cursor position after search autocompletion

This commit is contained in:
Lucas Gabriel Vuotto 2025-04-27 19:36:08 +00:00
parent 6250bb9699
commit b1cd0dad8d

View file

@ -63,6 +63,10 @@ document.addEventListener('alpine:init', () => {
this.$refs.tags.value = mySplice(value, pos, this.query.length, this.$refs.tags.value = mySplice(value, pos, this.query.length,
tag + ' '); tag + ' ');
this.reset(); this.reset();
this.inputCursor =
this.$refs.tags.selectionStart =
this.$refs.tags.selectionEnd =
pos + tag.length + 1;
this.$refs.tags.focus(); this.$refs.tags.focus();
// Don't switch focus if we're completing after a Tab press. // Don't switch focus if we're completing after a Tab press.