html input behaviour

i've been wondering about this for awhile. when your text input starts running out of room the right side of it starts to disappear (as shown in this screen recording; gave the input a bg of hotpink to further illustrate) and its value starts getting cut off. is there a way to stop this behaviour or always make sure its the width of its value? (well besides min-width: npx or something) like does it recognize its input.value as content ? doesnt seem like it or it wouldnt hide itself, it would overflow which would be better.
8 Replies
MarkBoots
MarkBootsβ€’7mo ago
unfortunatly there is no native solution for it .... yet. If i remember correctly there is something coming to auto size the input to the value size (will try to find a refference to it) for now, you could make your current input a button or div or whatever (maybe a div with contenteditable so you can still type in it) and then with js copy it to a temp input for the clipboard copy something like this: (pen removed, see screenshot below) ohw, i've found the new property: field-sizing: content It is already in chromium here an earlier post were i have an example https://discord.com/channels/436251713830125568/1223333018798788618/1223541118508204092
clevermissfox
clevermissfoxOPβ€’7mo ago
ohh thats exciting! i will have to add it to my list of properties/functions to watch! wow i wouls have never thought of that , to create an remove a textarea. it happens so fast i dont even see it in the dom
MarkBoots
MarkBootsβ€’7mo ago
you could even hide it with css to be sure
clevermissfox
clevermissfoxOPβ€’7mo ago
if its hidden with display: none will the text still be selectable for the function or would it have to be an opacity/visibility property? or perhaps an 'sr-only' class ? also is there a reason you chose textarea and not input[type=text] or just personal preference?
MarkBoots
MarkBootsβ€’7mo ago
Not for sure, but a fixed position (no shifting in the document) and 0 opacity should be enough for that short amount of time Both input and textarea are okay. I had copied it from a project i used before. there i did want to show it for a short time
clevermissfox
clevermissfoxOPβ€’7mo ago
Gotcha thank you ❣️
MarkBoots
MarkBootsβ€’7mo ago
I removed the pen, here a screenshot for future reference
No description
clevermissfox
clevermissfoxOPβ€’7mo ago
Thank you, I think i forked it tooπŸ™πŸ»
Want results from more Discord servers?
Add your server