OvermindDL1 / bucklescript-tea

TEA for Bucklescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`readonly` does not work as a property

walfie opened this issue · comments

I tried using Tea.Html2.Attributes.readonly on an input field and expected the field to be unmodifiable, however that wasn't the case.

It seems like the issue might be that currently it's set as a property rather than an attribute:

let readonly b = if b then prop "readonly" "readonly" else noProp

It worked when I tried using Vdom.attribute "" "readonly" "readonly" instead. E.g.,

let view model =
  div
    []
    [ input' [ Tea.Html2.Attributes.readonly true; value "hello" ] []
    ; input' [ Vdom.attribute "" "readonly" "readonly" ; value "hello" ] []
    ]

The first input field is modifiable when it shouldn't be (in Chrome, at least).

As a sidenote, this property is only in Html2 and is missing from Html, I'm not sure if that's intentional.

Oy, yeah that should be an attribute, correcting in next version.

Html2 follows Elm's 0.18+ API, Html follows Elm's pre 0.18 API, they fully work together though, just some naming conflicts at times. :-)

Ah, it came in from a PR, might be others I need to look over too... For now this one is fixed in, 0.15.0, sorry for the delay, Covid-19 stuff. ^.^;

Thanks!