mdgriffith / elm-ui

What if you never had to write CSS again?
https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/
BSD 3-Clause "New" or "Revised" License
1.35k stars 111 forks source link

Input placeholder remains visible when field is not empty #71

Closed PascalLeMerrer closed 4 years ago

PascalLeMerrer commented 5 years ago

Here is a simple example

Expected behavior As soon as a char is entered in the input field, the placeholder should disappear.

Versions

scottkipfer commented 5 years ago

This is because text never gets updated and is always an empty string. The text input should be kept in the model and then using the onChange handler to update the model will make the placeholder go away.

https://ellie-app.com/48KhsB753r4a1

This is also related to #63

alexkorban commented 4 years ago

unexpected

mdgriffith commented 4 years ago

I left a comment on #63 : https://github.com/mdgriffith/elm-ui/issues/63#issuecomment-631469931

Basically this seems like built-in virtualdom behavior as opposed to something elm-ui could adjust. Beyond using the browser placeholder element, though that has limitations as well.

I'm also not sure this actually a problem. If you're using elm to handle a text input, you are going to be tracking a value in your model, yeah?

I'm going to close this for now and make a note in the docs to help people avoid it in the future.