Elm with IE11 and date input fields

It appears that Elm is not compatible with IE11 :frowning:

As this issue shows, Elm crashes in IE11. There has been a patch in this PR, but it seems to be bit-rotting.

The crasher is unfortunate, because you cannot polyfill that behaviour of IE away. and IE11 is going to be supported for as long as Windows 10 is being kept alive, which is more than a decade still.

Now I could simply not produce input[type=date]fields, but that seems to be the wrong approach. If only, because I want to stay as semantically correct as possible. Also, I prefer native widgets over custom ones. And, of course, using the,e.g. elm-datepicker (sorry, I cannot put a link yet, because I’m a new user… hxxp://package.elm-lang.org/packages/elm-community/elm-datepicker/), would mean that I have to alter my code to carry the date picker’s state along.

Now my question is: What options exist to make Elm 0.18 IE11 compatible (where compatible really means that it shouldn’t crash) and how difficult do you think they are to realise?

I see:

  1. ship a patched version of virtual dom.
  2. use a web component.
  3. Somehow detect IE11 from within Elm and avoid producing a date input.
1 Like

I tried to answer in the PR. In summary, I think you can do:

import Html exposing (input)
import Html.Attributes exposing (atribute)

date =
  input [ attribute "type" "date" ] []

To get it to use setAttribute all the time.

The main reasons the PR you mention is stalled are (1) it seems like there is a path that doesn’t introduce a ton of special casing, (2) it is risky though because it may make other things start breaking in other browsers and we need to test that, and (3) we tend to batch releases so that a bunch of fixes can be tested at once and folks are not getting little risky changes in patches all the time.

3 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.