I'm currently working on a component in React that involves using an input field to type query syntax, similar to (A=2 and B="Value2"). My goal is to highlight errors by displaying a red wavy line below objects that are incorrect, without affecting the entire query.
So far, I've tried the following methods:
I initially used a div with transparent text color, positioned below the input field. I mapped the errors in this div and displayed the wavy line. This method worked well within a fixed width limit, but once the input value exceeded the width of the field and became scrollable, the div did not scroll along with it.
Another approach I attempted was using a contentEditableDiv to manipulate innerHTML, but this caused some complications with other necessary components.
The first method would be ideal if I could figure out a way to make the div scroll in sync with the input value. Despite my efforts, I haven't been able to find a suitable solution for this yet.
If anyone has any suggestions or a better approach to achieve this, I would greatly appreciate the help!
Thank you in advance!