Why does twitter.com use div role=button instead of button?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • react-native-web

    Cross-platform React UI packages

  • Afaik twitter uses (some form of) react-native-web.

    So I guess it's because: https://github.com/necolas/react-native-web/pull/556

    Basically some browsers don't support display flex on certain elements like button, using a div instead of a button solves that issue.

    Generally: I would suggest to use a button tag unless you run into issues (and know what you are doing).

    I don't think using `

    ` is perse worse as long as you implement all the behaviour and styling of the button element like focus, keyboard events and similar.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts