I had the auto width calculated incorrectly when the page load at first but then if I change or remove the text from input, it worked correctly. Here is a video showing exactly when it happens
https://giphy.com/gifs/hWpIELosaTxjlcMyCW
the domain name in the video is just a element. Only the subdomain is the textbox. I just styled this the way so the whole line look like a textbox.