We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6b1246a + 7ada185 commit 3b06812Copy full SHA for 3b06812
1 file changed
src/text-expander-element.ts
@@ -103,7 +103,9 @@ class TextExpander {
103
}
104
105
private positionMenu(menu: HTMLElement, position: number) {
106
- const caretRect = new InputRange(this.input, position).getBoundingClientRect()
+ // Clamp position to valid range to avoid IndexSizeError when input text changes
107
+ const clampedPosition = Math.min(position, this.input.value.length)
108
+ const caretRect = new InputRange(this.input, clampedPosition).getBoundingClientRect()
109
const targetPosition = {left: caretRect.left, top: caretRect.top + caretRect.height}
110
111
const currentPosition = menu.getBoundingClientRect()
0 commit comments