MS Edge label > input[type=file] bug: workaround

by Barney Carroll

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js"></script>
    <h1>Hello, world!</h1>

    <!-- jQuery first, then Bootstrap JS. -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/mithril/0.2.5/mithril.min.js"></script>
<div id="main">

</div>

JavaScript

var MainThing = {
  controller: function(opts){
  
  },
  view: function(ctrl, opts){
    return m("form",
      m("label.file[for=inputID]",
      	m("span.file-custom")
      ),
      
      m("input#inputID[type=file]"),
      
      m("label.file[for=inputID]",
      	m("span.file-custom")
      )
    )
  }
}

m.mount(document.getElementById("main"), MainThing);