Search code examples
material-designmaterial-componentsmaterial-components-web

How to check if material-components-web or MDC-Web is supported by a browser


I implemented MDC-Web in a webpage and it works with Chrome/Firefox on smartphones. However, select menu component is not working for Samsung browser on mobile devices.

I'm looking for a way to check if a MDC component is supported by a browser, in my JavaScript code, rather than checking out manually on every single browser available.

Does anybody know how I can do that? Is it possible?


Solution

  • To temporarily solve your select menu issue try Material Components Web 0.29.0 (or less), using the css only implementation, that relies on native element:

      <div class="mdc-select">
         <select class="mdc-select__surface" id="demo-select">
            <option value="1">First</option>
            <option value="2" selected>Second</option>
            <option value="3">Third</option>
         </select>
         <div class="mdc-select__bottom-line"></div>
      </div>
    

    After 0.29.0 they removed this implementation, but they are reverting back.

    Sadly I don't know if there is a resource to check browser compatibility against MDC Web.