Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label does not float when I provide an Options.onInput #376

Closed
lwheng opened this issue Jun 14, 2018 · 6 comments
Closed

Label does not float when I provide an Options.onInput #376

lwheng opened this issue Jun 14, 2018 · 6 comments

Comments

@lwheng
Copy link

lwheng commented Jun 14, 2018

I refer you to the "Labelled textfield, floating label" example for textfields. It seems that when I provide an onInput, the label won't float. Below is a screenshot when I added an Options.onInput to the textfield in your demo

[Edit] I forgot to mention that it is only after the textfield is out of focus

floating label issue

@lwheng
Copy link
Author

lwheng commented Jun 27, 2018

It appears that is-dirty is not set

@lwheng
Copy link
Author

lwheng commented Jul 9, 2018

My hack:

Mdl msg_ ->
    Material.update Mdl (Debug.log "msg_" msg_) model |> Just

Upd2 str ->
  let
    newModel = { model | str2 = str }
  in
    update (Mdl <| Component.TextfieldMsg [2] (Textfield.Input str)) newModel

I added a Debug.log "msg_" msg_ and observed that when I added an Options.onInput to the Textfield, the Input (Textfield's Msg) is not triggered. So this hack is to trigger it manually

@lwheng
Copy link
Author

lwheng commented Jul 9, 2018

Ah.. another hack:

Textfield.render Mdl
    [ 2 ]
    model.mdl
    [ Textfield.label "Floating label"
    , Textfield.floatingLabel
    , Textfield.text_
    , Options.onInput Upd2
    , Textfield.value model.str2
    ]
    []

Notice Textfield.value model.str2. This is probably the better hack I guess

@lwheng
Copy link
Author

lwheng commented Jul 9, 2018

Looks like people are just dealing it with a workaround #333

@lwheng lwheng closed this as completed Jul 9, 2018
@yhendry
Copy link

yhendry commented Jul 10, 2018

The link issue/333 didn't work

@lwheng
Copy link
Author

lwheng commented Jul 10, 2018

Updated the URL. Turns out I'm an idiot with markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants