I am having a Textarea blur problem that fails to reposition a floating label after clicking out out of the Textarea after a paste.
I PASTE some text into a Textarea and exit the Textarea in any way (Ctrl-Enter or click outside the area), which then causes the Textarea to Blur, the LABEL (e.g. Summary Annotation) does not move out of the Textarea as the label should. Instead, it stays put and overlaps the pasted text.
Only if I make a manual keystroke BEFORE I leave the Textarea will the label return to it's original position ABOVE the Textarea when it is blurred.
Is there a direct way of solving this? Under other circumstances (non VUE 3), I would try to manually trigger the Textarea, but I don't think I can do that with a VUE DOM.
Here is the paste routine:
const textAreaPaste = (e: ClipboardEvent) => {
let clipboardData, pastedData;
let textResult = "";
const target = e.target as HTMLTextAreaElement;
if (e) {
e.preventDefault();
nextTick(() => {
// Get pasted data via clipboard API
clipboardData = e.clipboardData;
pastedData = clipboardData ? clipboardData.getData("Text") : "";
//Remove carriage returns
const t1 = pastedData.replace(/\r(?!\n)|\n(?!\r)/g, "\n");
// Insert the text in the correct editing position, if necessary
if (e.target && (target.selectionStart || String(target.selectionStart) === "0")) {
var startPos = target.selectionStart;
var endPos = target.selectionEnd;
textResult = target.value.substring(0, startPos) + t1 + target.value.substring(endPos, target.value.length);
} else {
textResult += t1;
}
// Truncate to max length
(e.target as HTMLInputElement).value =
textResult.length > maxAnnoLetter ? textResult.substr(0, maxAnnoLetter) : textResult;
const attribs = (e.target as HTMLInputElement).attributes;
const id = (attribs as HTMLAttributes).id;
// Timeout on update necessary
if (id) {
setTimeout(() => {
calcRemainingChars(id.nodeValue, textResult);
}, 250);
}
});
}
};

