base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[Switch] Improve design across libraries

Open oliviertassinari opened this issue 2 years ago • 8 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Steps to reproduce 🕹

Link to live example:

  • Joy UI: open https://mui.com/joy-ui/react-switch/#introduction. It renders <Switch color="primary" />. Same in https://codesandbox.io/s/aged-haze-rjcfir?file=/demo.tsx
  • Base UI: https://mui.com/base/react-switch/#introduction
  • Material UI: https://mui.com/material-ui/react-switch/#introduction

Current behavior 😯

By order of what seems to be the most important to fix first:

  1. Joy UI. No active color contrast difference
Screenshot 2023-06-03 at 13 16 10 Screenshot 2023-06-03 at 13 16 27
  1. Joy UI. No toggle animation

https://github.com/mui/material-ui/assets/3165635/1586d47b-4cc7-4a89-b6aa-ea81699965a8

  1. Joy UI, Material UI, Base UI. No focus visible style when using Space to toggle.

https://github.com/mui/material-ui/assets/3165635/51940248-256d-4911-b5d9-961448a71dd8

Expected behavior 🤔

These design issues fixed.

Context 🔦

I opened this issue as part of an ongoing effort to focus on design execution.

cc @michaldudak as the owner of this component https://www.notion.so/mui-org/Components-Inputs-ecd48c9afe354bda8ecda3e96abc8c3c (also now that we have more team members we could consider splitting down the ownership areas). Now this both impacts Joy UI, Base UI, and Material UI.

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

oliviertassinari avatar Jun 03 '23 11:06 oliviertassinari

@oliviertassinari I would like to work on this

gitstart avatar Jun 05 '23 09:06 gitstart

Should we separate this issue into smaller, focused, ones? The first thing there from Joy looks like a bug. The second is more of an enhancement/polish, and the third could also be considered a bug/missing a11y-related treatment.

danilo-leal avatar Jun 05 '23 20:06 danilo-leal

Should we separate this issue into smaller, focused, ones? The first thing there from Joy looks like a bug. The second is more of an enhancement/polish, and the third could also be considered a bug/missing a11y-related treatment.

Agree, @siriwatknp, @DiegoAndai, @michaldudak would you like to go trough the issue and create one for each of the packages?

mnajdova avatar Jun 21 '23 14:06 mnajdova

@mnajdova I'll create Material's issue. Before that, let me know if I understand the issue correctly: The issue is that the focus-visible style is not applied when using space to toggle right after toggling the Switch via clicking it, right?

I'm seeing that when using space after getting to the Switch via tabbing, it works as expected.

cc: @danilo-leal

DiegoAndai avatar Jun 22 '23 14:06 DiegoAndai

FYI, when mui/material-ui#37303 lands, the logic behind focus-visible in Switch will change slightly. Let's wait with further fixes until it's merged.

michaldudak avatar Jun 22 '23 17:06 michaldudak

Should we separate this issue into smaller, focused, ones?

This issue could be considered an umbrella issue. I think that it depends, if the owner of the <Switch> component is taking on this issue, it might not be necessary to split.

oliviertassinari avatar Jun 26 '23 23:06 oliviertassinari

To be fair, on point 1. there are use cases, but I believe these should be part of the long tail of customization needs, e.g.

https://github.com/mui/material-ui/assets/3165635/a01afb8c-97c8-467f-8594-3ad5517f394e

https://bitly.com/pages/pricing

oliviertassinari avatar Jul 08 '23 14:07 oliviertassinari

☝️ Interesting, thanks for sharing it! I was also thinking that the track not changing its color was mostly a bug but it might indeed make sense to support it but not as the default behavior, I'd say.

danilo-leal avatar Jul 10 '23 23:07 danilo-leal

The part related to Base UI (focus ring) has been fixed.

michaldudak avatar Aug 02 '24 12:08 michaldudak