• 3 Posts
  • 10 Comments
Joined 3 months ago
cake
Cake day: December 11th, 2024

help-circle



  • The linked site has a bit more about it, but usually you see toggle switches like that with relatively “balanced” options. “On” / “Off” are about the same width when rendered as text. It’s easy then to just make the switch big enough for the bigger option and everything’s good. What happens if you have “On” and “Some really long text option that should probably be shorter”? The image shows what it looks like toggled to “On”, and then goes over two solutions, neither of which are great options:

    • Use the smallest size and cut off the larger text. Not really a viable option
    • Use the longest size, but when the shorter option is toggled to, you’re left with a bunch of blank space


  • There’s actually a proposal for various new HTML elements, including a switch:

    https://open-ui.org/components/switch.explainer/

    It’s a little bit harder than you think, because people will definitely do things like this, and they have to account for that sort of behavior:

    It is nice to see that they’re working on it, where “they” means part of the W3C (so not just random nobodies):

    The purpose of the Open UI, a W3C Community Group, is to allow web developers to style and extend built-in web UI components and controls, such as <select> dropdowns, checkboxes, radio buttons, and date/color pickers.

    To do that, we’ll need to fully specify the component parts, states, and behaviors of the built-in controls, as well as necessary accessibility requirements, and provide test suites to ensure compatibility. We’ll also implement polyfills for our extensible web UI controls.

    Today, component frameworks and design systems reinvent common web UI controls to give designers full control over their appearance and behavior. We hope to make it unnecessary to reinvent built-in UI controls, but for those who choose to do so, we expect that these design systems will benefit from Open UI’s specifications and test suites.

    Long term, we hope that Open UI will establish a standard process for developing high-quality UI controls suitable for addition to the web platform.