Most of it's just contenteditable doing the work, but there are a lot of little things, yes. But "someone else" does all that non-trivial work, and packages it together into a library called "contenteditable-plus" or something of the like; and then some devs end up using the element from that library for every single text <input> they need on a page.
See e.g. BlueprintJS's Suggest: https://blueprintjs.com/docs/#select/suggest