Page MenuHomePhabricator

ToggleSwitch: Clarify and update desktop versus mobile design
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

  • Description: Clarify and update desktop versus mobile design
  • History: describe or link to prior discussions related to this component
  • Considerations: list any known challenges or blockers, or any other important information

User stories

  • Ensure ToggleSwitch is usable in regards to touch interaction size requirements.

Previous implementations

Proposal

  • Toggle Switch will be updated with the following sizes:
    • Grip: 20px
    • Width: 48px
    • Height: 32px
  • Desktop and mobile will use the same size
  • ToggleSwitch size will be updated in both Codex and OOUI libraries and demos (so it's visually the same in all OOUI and Codex projects).

Design spec

Open questions

List here open questions related with this task.

Acceptance criteria (or Done)

Design

  • Create Figma spec sheet with the new sizes proposal and link it in this task
  • Update the component and spec sheet in the Codex and OOUI libraries
  • Update the specs images with the new size in the Design Style Guide

Code

  • Update the component in Codex
  • Update the component in OOUI

Event Timeline

@Volker_E - can you please put an initial/proposed priority level on this task and move it to the Backlog column?
DST prioritization guidance

Volker_E triaged this task as Medium priority.Jan 23 2023, 7:05 AM
Volker_E added a project: Design.
Volker_E moved this task from Inbox to Backlog on the Design-System-Team board.
Volker_E added a subscriber: bmartinezcalvo.
ldelench_wmf raised the priority of this task from Medium to High.Jan 27 2023, 4:22 PM

@Volker_E I've updated the Figma spec sheet with the new sizes discussed yesterday during our DS design sync:

  • 20px grip
  • 48px width
  • 32px height

These new sizes will be applied on both desktop and mobile toggle switch so there won't be a visual difference between both platforms. As commented yesterday, these changes will be applied in both Codex and OOUI demos so I will update both Figma libraries once the ToggleSwitch changes have been implemented.

Apart from this, we should update the DSG page with the new ToggleSwitch size.

Change 869866 had a related patch set uploaded (by VolkerE; author: VolkerE):

[design/codex@main] ToggleSwitch, tokens: Amend size and replace SFC vars with tokens

https://gerrit.wikimedia.org/r/869866

I wanted to double-check this because the focus-on state at 16px looks a bit uncomfortable IMO:

image.png (110×474 px, 16 KB)

The overall dimensions of the switch match the part of the design spec at the top that shows the dimensions, but the part of the design spec that shows states has not been updated, so the switch in the focus-on state is actually 56px wide instead of 48.

Additionally, the travel distance of the grip is shorter now, so I feel that the action of the switch is less clear.

If the design team is ok with the implementation in the patch, I'm happy to +2—just wanted to check!

Another issue is that the travel distance decreases with font size, but the dimensions of the switch hit min dimensions so they do not correspond. You can kind of see this at 14px but especially at 12px:

14px:

Screen Shot 2023-02-06 at 12.39.30 PM.png (96×466 px, 13 KB)

12px:

Screen Shot 2023-02-06 at 12.39.23 PM.png (110×422 px, 12 KB)

I wanted to double-check this because the focus-on state at 16px looks a bit uncomfortable IMO:

image.png (110×474 px, 16 KB)

The overall dimensions of the switch match the part of the design spec at the top that shows the dimensions, but the part of the design spec that shows states has not been updated, so the switch in the focus-on state is actually 56px wide instead of 48.

@AnneT there was an error in the spec. Fixed with 48px wide for all ToggleSwitches in the spec.

Additionally, the travel distance of the grip is shorter now, so I feel that the action of the switch is less clear.

If the design team is ok with the implementation in the patch, I'm happy to +2—just wanted to check!

We commented about this change during our last DS design sync and we all agreed that this new size was ok. But pinging my peers here so they can have a last review on this @KieranMcCann @Sarai-WMDE @Volker_E @RHo

image.png (110×474 px, 16 KB)

The overall dimensions of the switch match the part of the design spec at the top that shows the dimensions, but the part of the design spec that shows states has not been updated, so the switch in the focus-on state is actually 56px wide instead of 48.

Additionally, the travel distance of the grip is shorter now, so I feel that the action of the switch is less clear.

I've made a similar comment in the design review, the smaller width is a bit counter-productive from experience. We had to make a compromise here as we didn't think inventing a 56px equiv size token would make sense and found 48 acceptable.

Another issue is that the travel distance decreases with font size, but the dimensions of the switch hit min dimensions so they do not correspond. You can kind of see this at 14px but especially at 12px:

14px:

Screen Shot 2023-02-06 at 12.39.30 PM.png (96×466 px, 13 KB)

12px:

Screen Shot 2023-02-06 at 12.39.23 PM.png (110×422 px, 12 KB)

Latest patch is fixing this with a solid solution towards font-size flexibility.

Seems 48px seems OK to me for mobile, but it would be good to understand the reason for keeping that larger size for desktop, instead of having it scale down similar based on text-size to other elements like Buttons, etc. Wonder if @KieranMcCann has thoughts based on his work similarly around the icon sizes and similar debate about making accordion arrows related to component font-size.

For clarification, the ToggleSwitch is rendered 48x32px on mobile and desktop and with that is equivalent in height to buttons size on desktop.

For clarification, the ToggleSwitch is rendered 48x32px on mobile and desktop and with that is equivalent in height to buttons size on desktop.

My bad, I was confused thinking about proposals for button variants that are more relatively-sized and styled to inline text (mentioned in T327426#8549928 and proposed for some button on Vector-2022 in T325553)
One proposed I have to review is putting all the Codex form elements together in context in a sample UI on desktop (different sections of User Preferences for example) to see if that smaller 14px font-size on Desktop makes these components look awkwardly large. Or is the intention is that this will be moot as Desktop is expected to change to 16px base in some near-ish point in time?

Seems 48px seems OK to me for mobile, but it would be good to understand the reason for keeping that larger size for desktop, instead of having it scale down similar based on text-size to other elements like Buttons, etc. Wonder if @KieranMcCann has thoughts based on his work similarly around the icon sizes and similar debate about making accordion arrows related to component font-size.

One proposed I have to review is putting all the Codex form elements together in context in a sample UI on desktop (different sections of User Preferences for example) to see if that smaller 14px font-size on Desktop makes these components look awkwardly large. Or is the intention is that this will be moot as Desktop is expected to change to 16px base in some near-ish point in time?

We will have something kind of like that once T315621 is done. It will provide access to this demo page in a place that's easier to get to and is updated as the code changes over time.

It sounds to me like we can move forward with the patch, especially since the difference in grip travel distance per font size has been fixed. We can always go back and make changes if needed; I don't believe this component is in use anywhere other than the Codex docs site.

Change 869866 merged by jenkins-bot:

[design/codex@main] ToggleSwitch, tokens: Amend size and replace SFC vars with tokens

https://gerrit.wikimedia.org/r/869866

Moving to Ready for dev for the OOUI part.

Change 889230 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[mediawiki/core@master] Update Codex from v0.5.0 to v0.6.0

https://gerrit.wikimedia.org/r/889230

Test wiki created on Patch demo by ATomasevich (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/66d018802f/w

Change 889230 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.5.0 to v0.6.0

https://gerrit.wikimedia.org/r/889230

I've updated the ToggleSiwtch size component in our Figma libraries in these branches:

I've updated the following:

  • Updated ToggleSwitch size: 20px grip, 48px width and 32px height.
  • Desktop and mobile will use now the same size so merged both components in one only
  • Added keyboard navigation table in the spec sheet
  • Updated the component's description in the spec introduction and explained when to use and when not to use ToggleSwitch component
NOTE: I will merge these Figma branches once the component updates are fully implemented.

Change 900362 had a related patch set uploaded (by VolkerE; author: VolkerE):

[oojs/ui@master] WikimediaUI theme: Unify ToggleSwitch with latest Codex design spec

https://gerrit.wikimedia.org/r/900362

Change 900362 merged by jenkins-bot:

[oojs/ui@master] WikimediaUI theme: Unify ToggleSwitch with latest Codex design spec

https://gerrit.wikimedia.org/r/900362

@Volker_E ToggleSwitch new size looks good.

But there is a problem with the demo text and radio sizes. Not sure if this is related to this patch or not, but they are too small now.

Captura de pantalla 2023-05-09 a las 11.02.05.png (914×1 px, 149 KB)

That's an unrelated issue that is caused by VitePress putting small font-size on the tabular data td.
I ran into it relatedly in T336208: docs: VitePress demo shows wrong token sizes due to fixed px value

Will work on it in T325788: Component scaling and minimum sizes.

Volker_E updated the task description. (Show Details)
Volker_E set the point value for this task to 3.

Test wiki on Patch demo by ATomasevich (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/66d018802f/w/

Change 921070 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update OOUI to v0.47.0

https://gerrit.wikimedia.org/r/921070

Change 921070 merged by jenkins-bot:

[mediawiki/core@master] Update OOUI to v0.47.0

https://gerrit.wikimedia.org/r/921070