Page MenuHomePhabricator

Design and build initial ToggleButtonGroup component (MVP)
Closed, ResolvedPublic5 Estimated Story Points

Assigned To
Authored By
Catrope
Jun 16 2022, 4:58 AM
Referenced Files
F35596982: image.png
Oct 18 2022, 6:32 PM
F35595481: Captura de Pantalla 2022-10-18 a las 13.11.00.png
Oct 18 2022, 11:12 AM
F35595477: Captura de Pantalla 2022-10-18 a las 13.03.40.png
Oct 18 2022, 11:12 AM
F35551017: image.png
Oct 6 2022, 9:05 PM
F35550964: image.png
Oct 6 2022, 9:05 PM
F35505438: Grabación de pantalla 2022-09-01 a las 17.48.28.mov
Sep 1 2022, 3:50 PM
F35501889: image.png
Aug 31 2022, 6:56 PM
F35501891: image.png
Aug 31 2022, 6:56 PM

Description

This task defines the minimum viable product (MVP) of the ToggleButtonGroup component.


Scope

Design spec

Anatomy

A ToggleButtonGroup consists of 2 or more buttons displayed horizontally adjacent to each other.

The initial component has two variants:

  • The "single-select toggles" variant: a group of ToggleButtons, where only one can be selected (toggled on) at one time (similar to a group of radio buttons)
  • The "multiselect toggles" variant: a group of ToggleButtons, where multiple buttons can be selected (toggled on) at any one time (similar to a group of checkboxes)

The design specifies that icons should be used consistently across buttons: buttons in an ActionButtonGroup should all be one of the following:

  • Text only
  • Icon + text
  • Icon-only

If feasible, we should inspect the data or slot contents to see if this specification is met and, if not, emit a warning to the console explaining that icon usage should be consistent across buttons.

Style

The initial component will present the following visual features:

  • Buttons are displayed next to each other (horizontally)
  • The borders of adjacent buttons overlap
  • The first and last buttons have rounded corners on the outside; all the other corners are sharp (not rounded)
  • Disabled behavior:
    • The ToggleButtonGroup as a whole can be disabled, in which case all of its child buttons are disabled
    • Any button within a ToggleButtonGroup can be individually disabled
      Screenshot from 2022-06-15 21-32-35.png (1,127×110 px, 13 KB)

Interaction

The initial component will follow these interaction specifications:

For the "single-select toggles" variant:

  • Only one button can be selected (toggled on) at any time. When a button is clicked, it becomes selected, and if any other button was already selected, that button becomes unselected.
  • If an already-selected button is clicked, nothing happens; it is not unselected (analogous to a radio button)

For the "multiselect toggles" variant:

  • Multiple buttons can be selected at the same time. When a button is clicked, it becomes selected, and any other buttons that might already be selected stay selected
  • If an already-selected button is clicked, it is unselected (analogous to a checkbox)
Screenshot from 2022-06-15 16-49-44.png (306×76 px, 4 KB)
Screenshot from 2022-06-15 16-49-53.png (215×74 px, 4 KB)
  • An initial value can be provided, or an empty array. Nothing will be selected by default.

Documentation

  • Structure: ToggleButtonGroup is part of the "Button" sidebar group
  • Content:
      • A demo with five toggle buttons in single-select mode, each of which displays a number (see the "single selection" image above)
      • A demo with three toggle buttons in mulitselect mode
      • A demo with three icon-only toggle buttons in single-select mode. This demo should contain text that explains that icons should be used consistently in button groups, e.g. no buttons have icons, all buttons have icons and text, or all buttons are icon-only. It should also explain that buttons should only be icon-only if self-explanatory icons are used. See the design spec for a good example.
    • A maximum example with 5 toggle buttons in single-select mode. At least one of the buttons should have a very long label and the button group should break to two rows.
      • A configurable demo is not recommended for this component.

Considerations

Not in scope:

  • Groups of toggle quiet buttons are not in scope for the MVP
  • Enforcing a maximum number of buttons by moving the stacked buttons to a different solution is not in scope for the MVP

Open questions:

  • How does the parent choose which variant to use? Does it pass in a prop? What is that prop called?
  • Should the ToggleButtonGroup (1) create its child buttons itself based on a data object describing each button (like how Menu creates its child MenuItems), or (2) should its child buttons be created by the ToggleButtonGroup's parent and passed into the default slot?
    • If (2), how will we manage the mutual exclusivity of buttons in a "single-select" ToggleButtonGroup, and how will we aggregate the value of the selected button(s) in a "single-select" or "multiselect" ToggleButtonGroup? Could we use a similar strategy as radio buttons and checkboxes, where we bind the same v-model on all toggle buttons in a group?
    • If (2), is there even a point in having a ToggleButtonGroup component? Would the component do anything at all, other than apply styles? Is it possible for the component to cleverly manage buttons that have been passed into it through a slot, perhaps by using slot parameters or by doing something like what Tabs does?

See T311537 for more info. The outcome of that task will determine the API for both ToggleButtonGroup and ActionButtonGroup.


Acceptance criteria

This task will pass from the designer to the developer once the Figma spec is created.

  • A Figma spec sheet is created for the component that includes the scope defined here. A link to the Figma spec sheet's MVP version has been added to this task's description.
  • The initial component is implemented in Codex.

Design Review

  • Add configurable demo in the page It won't be part of the MVP
  • Add the following examples in the demo
    • Icon-only
    • With icon
    • Maximum examples (same as here)
  • Fix stacked buttons

Test Cases

Existing test cases for reference

  • Test maximum cases:
    • Entering a long text as a button label - would this truncate or uniformly expand all buttons in the group?
    • When there is not enough horizontal space for all buttons the rest of buttons must be stacked
  • Consistent button state across major browsers - there has been some history of visual differences seen in Safari 15.1.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 816870 merged by jenkins-bot:

[design/codex@main] ToggleButtonGroup: Initial implementation

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

@Catrope the following sections are missing in the demo page:

  • Toggle ButtonGroup with icon-only buttons
  • Maximum example section with the example described here for long text buttons

Regarding the stacked buttons, as I commented in T311756 is there a way to solve this?

Change 821782 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] ToggleButtonGroup: Add maximum example, icon-only example

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

@Catrope the following sections are missing in the demo page:

  • Toggle ButtonGroup with icon-only buttons
  • Maximum example section with the example described here for long text buttons

Done in the attached patch.

Regarding the stacked buttons, as I commented in T311756 is there a way to solve this?

The stacking issues are largely fixed as part of the changes I made for T311756 (my changes were in shared code that is used for both ButtonGroup and ToggleButtonGroup). As I said on that task, there is one ToggleButton-specific issue where if two adjacent buttons are toggled on and the line breaks between those two buttons, the second button (the one that gets pushed to the next line) is misaligned with the one above it. This also happens with disabled buttons. It's possible that there could be a creative solution for this, but I haven't found one yet.

@Catrope regarding stacked buttons:

  1. If we separate the adjoined toggled buttons with a white line, the logical thing would be to separate the toggled stacked buttons too with another white line, right?

    Captura de Pantalla 2022-08-10 a las 13.58.43.png (1,986×290 px, 211 KB)


    Captura de Pantalla 2022-08-10 a las 13.53.56.png (954×350 px, 157 KB)


    I've updated the maximum example in the spec sheet to reflect it.

    Captura de Pantalla 2022-08-10 a las 14.01.11.png (1,514×426 px, 169 KB)
  1. The white line that separates the toggled buttons (and disabled ones) it's like cut diagonally on top and on bottom, why?

    Captura de Pantalla 2022-08-10 a las 14.01.42.png (1,730×274 px, 129 KB)


    Captura de Pantalla 2022-08-10 a las 13.52.26.png (934×652 px, 207 KB)

Change 821782 merged by jenkins-bot:

[design/codex@main] ToggleButtonGroup: Add maximum example, icon-only example

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

Change 822139 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] ButtonGroup, ToggleButtonGroup: Straighten white lines between buttons

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

@Catrope regarding stacked buttons:

  1. If we separate the adjoined toggled buttons with a white line, the logical thing would be to separate the toggled stacked buttons too with another white line, right?

    Captura de Pantalla 2022-08-10 a las 13.58.43.png (1,986×290 px, 211 KB)


    Captura de Pantalla 2022-08-10 a las 13.53.56.png (954×350 px, 157 KB)


    I've updated the maximum example in the spec sheet to reflect it.

    Captura de Pantalla 2022-08-10 a las 14.01.11.png (1,514×426 px, 169 KB)

I agree that would make sense, but unfortunately this is hard to do well, because we can't detect when a toggled button has another toggled button below it. (The horizontal white lines are possible because CSS does allow targeting "a toggled button preceded by another toggled button".) We could set the top/bottom border color to white on toggled buttons, but that looks weird in other ways:

Screenshot from 2022-08-10 14-30-42.png (1,522×237 px, 41 KB)
Screenshot from 2022-08-10 14-31-05.png (613×142 px, 8 KB)
  1. The white line that separates the toggled buttons (and disabled ones) it's like cut diagonally on top and on bottom, why?

This happened because the white line isn't a separate thing, it's a border. The second (rightmost) button has a border that is white on the left, and blue on the other three sides (top, right, bottom). I was able to fix this in the attached patch by setting the width of the top and bottom borders to 0 in this case. This doesn't fix the problem where the white border can get pushed to the next line and cause the first button on the next line to look like it's 1px too far to the right though.

Screenshot from 2022-08-10 14-13-13.png (1,560×269 px, 41 KB)
Screenshot from 2022-08-10 14-13-17.png (954×149 px, 9 KB)

@Catrope I've found a possible solution to separate de stacked toggled buttons. If we add a white center border around the toggled buttons when the buttons, this white border would create a white line to separate both the horizontal and vertical buttons (you can inspect the button group with this solution here).

Captura de Pantalla 2022-08-11 a las 13.15.08.png (1,530×1,310 px, 551 KB)

Change 822139 merged by jenkins-bot:

[design/codex@main] ButtonGroup, ToggleButtonGroup: Straighten white lines between buttons

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

Change 822465 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] [WIP] ButtonGroup: White top/bottom borders on disabled/toggled buttons

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

Change 822465 abandoned by Catrope:

[design/codex@main] [WIP] ButtonGroup: White top/bottom borders on disabled/toggled buttons

Reason:

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

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

[mediawiki/core@master] Update Codex from v0.1.0-alpha.9 to v0.1.0-alpha.10

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

Change 823725 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.1.0-alpha.9 to v0.1.0-alpha.10

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

@Catrope I've found a possible solution to separate de stacked toggled buttons. If we add a white center border around the toggled buttons when the buttons, this white border would create a white line to separate both the horizontal and vertical buttons (you can inspect the button group with this solution here).

Captura de Pantalla 2022-08-11 a las 13.15.08.png (1,530×1,310 px, 551 KB)

@Catrope I added a possible solution to separate the stacked buttons with a white line. Tell me if the implementation would be possible since the task is pending to be moved to QTE sign-off.

I'm so sorry, I wrote the below last week but for some reason forgot to submit it

@Catrope I've found a possible solution to separate de stacked toggled buttons. If we add a white center border around the toggled buttons when the buttons, this white border would create a white line to separate both the horizontal and vertical buttons (you can inspect the button group with this solution here).

Captura de Pantalla 2022-08-11 a las 13.15.08.png (1,530×1,310 px, 551 KB)

The attached patch (https://gerrit.wikimedia.org/r/822465) keeps the white horizontal border between adjacent toggled-on buttons, and adds a white top+bottom border to every toggled-on button, even ones that are not adjacent to another toggled-on button. But this also affects button groups where the buttons don't overflow to the next line, so I don't think this is a good idea.

Here are some screenshots of situations where I think it doesn't look great. The separation between toggled/disabled buttons that are stacked on top of each other does look better, but that comes at the expense of non-stacked button groups looking worse IMO. You can compare the demo with my changes here vs the docs site without my changes here.

Before (without border change)After (with border change)
Screenshot from 2022-08-11 17-21-05.png (924×121 px, 12 KB)
localhost_3000_components_toggle-button-group.html.png (897×96 px, 14 KB)
Screenshot from 2022-08-11 20-53-11.png (531×122 px, 7 KB)
Screenshot from 2022-08-11 20-52-59.png (517×131 px, 7 KB)
Screenshot from 2022-08-11 20-54-26.png (1,527×229 px, 41 KB)
Screenshot from 2022-08-11 20-54-15.png (1,527×222 px, 41 KB)
Screenshot from 2022-08-11 20-55-15.png (562×210 px, 9 KB)
Screenshot from 2022-08-11 20-55-06.png (575×214 px, 9 KB)
Screenshot from 2022-08-11 20-58-05.png (493×123 px, 3 KB)
Screenshot from 2022-08-11 20-57-59.png (505×132 px, 3 KB)

Another possibility would be to add a 1px margin between the rows, which makes toggled and disabled buttons look better, and normal buttons look different (but not necessarily worse?)

Screenshot from 2022-08-17 15-56-33.png (522×96 px, 11 KB)
Screenshot from 2022-08-17 15-56-47.png (519×91 px, 13 KB)
Screenshot from 2022-08-17 15-57-18.png (400×155 px, 6 KB)

Change 824559 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] ButtonGroup: Use box-shadow instead of border between disabled buttons

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

I switched from using borders to using a box-shadow. This works very well for disabled buttons (see T311756#8167129), and it works mostly OK for toggled-on buttons, but there are some imperfections. If you look closely, you'll see that when toggled-on button has a toggled-off button to the left of it or above it, that toggled-off button's border will stop 1px too early and there's a white pixel that shouldn't be there. This is because the box-shadow isn't hidden beneath the neighbor's border as it is for disabled buttons.

Screenshot from 2022-08-18 13-31-26.png (537×267 px, 25 KB)

Screenshot from 2022-08-18 13-32-22.png (552×302 px, 27 KB)

Screenshot from 2022-08-18 13-26-35.png (549×287 px, 27 KB)

We could address this by putting toggled-on buttons below the other buttons, like we do with disabled buttons. That would make the borders of toggled-off buttons take priority over those of toggled-on buttons though, so it would change the design a little bit. Here's what that would look like:

Screenshot from 2022-08-18 13-42-04.png (309×101 px, 2 KB)

Screenshot from 2022-08-18 13-41-53.png (1,043×181 px, 25 KB)

We could address this by putting toggled-on buttons below the other buttons, like we do with disabled buttons. That would make the borders of toggled-off buttons take priority over those of toggled-on buttons though, so it would change the design a little bit. Here's what that would look like:

Screenshot from 2022-08-18 13-42-04.png (309×101 px, 2 KB)

Screenshot from 2022-08-18 13-41-53.png (1,043×181 px, 25 KB)

@Catrope with this new solution the stacked toggled buttons looks worse than with the previous one since the white shadow is not aligned with the gray border of the toggled-off button.

Captura de Pantalla 2022-08-22 a las 11.49.55.png (1,086×304 px, 196 KB)

Although the white shadow appears when the toggled-off is next to the toggled-on, I prefer this solution with the white shadow on left and on top of the button.

{F35483703}

{F35483706}

@bmartinezcalvo could you make the last two screenshots public? I can't see them

Screenshot from 2022-08-22 10-14-32.png (614×286 px, 41 KB)

@bmartinezcalvo could you make the last two screenshots public? I can't see them

Screenshot from 2022-08-22 10-14-32.png (614×286 px, 41 KB)

@Catrope done!

@Catrope I move the task to In Development since we need to solve the token treatment for the shadow used to separate the toggled-on and disabled buttons. Not sure if this should be the right column to move the task so feel free to move it again if needed.

Change 824559 merged by jenkins-bot:

[design/codex@main] ButtonGroup: Use box-shadow instead of border between disabled buttons

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

@Catrope with this new solution the stacked toggled buttons looks worse than with the previous one since the white shadow is not aligned with the gray border of the toggled-off button.
Although the white shadow appears when the toggled-off is next to the toggled-on, I prefer this solution with the white shadow on left and on top of the button.

Understood. The latest (just-merged) patch uses the version where the gray borders of the adjacent toggled-off buttons are not visible, which I think is what you said you wanted. Moving to design sign-off so that you can verify that the current version looks right.

  1. Chrome v104 - Toggled focus

The bottom border of the top button group (in the screenshot below) extends into the top border of the buttons below it. It looks a bit off, even though by design it should happen. Do we need to look at this again?

image.png (2,040×888 px, 118 KB)
image.png (1,966×898 px, 179 KB)
  1. All browsers - The corners of every last button on a line of the group should have a radius but it is square.
image.png (1,942×610 px, 91 KB)
image.png (2,968×512 px, 760 KB)
  1. Safari 15.6.1 - Overflow buttons

The bottom left corner of the button group does not have the right radius.

image.png (1,742×1,146 px, 826 KB)

  1. Chrome v104 - Toggled focus

The bottom border of the top button group (in the screenshot below) extends into the top border of the buttons below it. It looks a bit off, even though by design it should happen. Do we need to look at this again?

Unfortunately we don't have a good way to detect that there's another button below the button, so this would be difficult to fix without also changing what the focus outline looks like when the button is in the bottom row, or there is only one row of buttons. It's up to @bmartinezcalvo to decide, but there are some annoying technical constraints that mean we can't get everything we want.

  1. All browsers - The corners of every last button on a line of the group should have a radius but it is square.

I can't see these screenshots yet, but there's a known issue where, if you have a group that is split over multiple lines, the top right and bottom right corners aren't rounded, again due to annoying technical limitations. The top left and bottom left corners should always be rounded though, and when the group is on one line all the corners should be rounded.

  1. Safari 15.6.1 - Overflow buttons

The bottom left corner of the button group does not have the right radius.

image.png (1,742×1,146 px, 826 KB)

That's weird, I'll take a look at this in BrowserStack.

  1. Chrome v104 - Toggled focus

The bottom border of the top button group (in the screenshot below) extends into the top border of the buttons below it. It looks a bit off, even though by design it should happen. Do we need to look at this again?

Unfortunately we don't have a good way to detect that there's another button below the button, so this would be difficult to fix without also changing what the focus outline looks like when the button is in the bottom row, or there is only one row of buttons. It's up to @bmartinezcalvo to decide, but there are some annoying technical constraints that mean we can't get everything we want.

I think the focus border extends to the button below since they are stacked with -1px spacing right @Catrope?

What worries me most about the focus state is the following:

  1. The white top shadow in the button disappears when the button is focused (view the video below)

  1. The focus is not visible enough when the button is next to other toggled button.
Captura de Pantalla 2022-08-30 a las 10.13.44.png (2,348×388 px, 304 KB)
Captura de Pantalla 2022-08-30 a las 10.17.27.png (2,404×390 px, 299 KB)
Toggled-on button focusToggled-off button focus

Change 828083 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/core@master] Update Codex from v0.1.0-alpha.10 to v0.1.0

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

  1. Safari 15.6.1 - Overflow buttons

The bottom left corner of the button group does not have the right radius.

image.png (1,742×1,146 px, 826 KB)

That's weird, I'll take a look at this in BrowserStack.

It looks like this happens because Safari doesn't propagate the border-radius from the parent to the child in this situation, and instead cuts off the border with a rounded corner on the outside without rounding it on the inside (which, honestly, is what I expected to happen when I wrote this CSS, I was surprised to see that Firefox and Chrome handle it so nicely). As far as I know we won't be able to work around this without going back to the same issues that we had before with the rounded corners being on the first/last button without regard to whether the buttons are split over multiple lines.

Change 828128 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] ToggleButtonGroup: Combine focus shadow and white border shadow

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

I think the focus border extends to the button below since they are stacked with -1px spacing right @Catrope?

Yes, that's right. Note that this happens in the horizontal dimension too: there's a -1px margin between the buttons so that their borders overlap, and so when a button is focused its focus border/shadow extends into the buttons to the left/right as well.

What worries me most about the focus state is the following:

  1. The white top shadow in the button disappears when the button is focused (view the video below)

This is because part of the blue focus border is implemented as a white and blue box-shadow`, which overrides our white box-shadow. I've attempted to fix this in https://gerrit.wikimedia.org/r/c/design/codex/+/828128 . but I'm not sure if I did it correctly because I don't know exactly what visual effect I'm looking for. Could you take a look?

  1. The focus is not visible enough when the button is next to other toggled button.
Captura de Pantalla 2022-08-30 a las 10.13.44.png (2,348×388 px, 304 KB)
Captura de Pantalla 2022-08-30 a las 10.17.27.png (2,404×390 px, 299 KB)
Toggled-on button focusToggled-off button focus

How do you think we should fix this? Perhaps we could add another 1px white shadow outside the existing focus shadow? (So change it from a 1px white shadow with a 1px blue shadow around it, to 1px white + 1px blue around it + 1px white around that)

  1. The focus is not visible enough when the button is next to other toggled button.
Captura de Pantalla 2022-08-30 a las 10.13.44.png (2,348×388 px, 304 KB)
Captura de Pantalla 2022-08-30 a las 10.17.27.png (2,404×390 px, 299 KB)
Toggled-on button focusToggled-off button focus

How do you think we should fix this? Perhaps we could add another 1px white shadow outside the existing focus shadow? (So change it from a 1px white shadow with a 1px blue shadow around it, to 1px white + 1px blue around it + 1px white around that)

@Catrope it seems that when the button is focus the white left and top shadows disappear so the separation between toggled buttons is not visible. The white outset shadow in the toggled buttons should be always visible, even when the toggled button is focus:

Captura de Pantalla 2022-08-31 a las 10.04.36.png (2,660×726 px, 928 KB)

Captura de Pantalla 2022-08-31 a las 10.04.04.png (2,550×770 px, 1 MB)

Thanks @bmartinezcalvo, that helps a lot! I have updated my patch to implement that, you can see it here. I added a 1px outset white shadow to the existing focus shadow (which is a 1px inset blue shadow plus a 2px inset white shadow). That's almost the same as the shadow that creates the white lines, except it's on all four sides instead of just at the top and left.

image.png (910×267 px, 23 KB)

For simplicity, my patch also changes the white lines shadow (the one that appears on unfocused toggled-on buttons, and on disabled buttons) to be on all four sides, which results in a small visual change at the corners in some cases:

BeforeAfter
image.png (251×252 px, 6 KB)
image.png (251×252 px, 6 KB)

Change 828083 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.1.0-alpha.10 to v0.1.1

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

@Catrope thank you for updating the patch with this new solution but I think it works worse than the previous one since now the toggled-on button seems bigger than the toggled-off one (it seems to grow when you select it).

I've updated my patch to change the white lines back, but keep the focus treatment. (Sorry for the delay, I wrote this patch on my flight last week but forgot to upload it after landing.)

Change 828128 merged by jenkins-bot:

[design/codex@main] ToggleButtonGroup: Combine focus shadow and white border shadow

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

ldelench_wmf set the point value for this task to 5.Sep 27 2022, 3:22 PM

Hi @Catrope, this look better!

Just one thing: from the Figma design, it appears that the buttons above have a constant white space padding at their base, This makes them always appear "suspended" especially when the buttons below are in a toggled-on state.

image.png (1,608×890 px, 145 KB)

On the demo page, if a button above and below are toggled-on, it seems the button below is eating into the button above, due to the absence of this white padding.

image.png (2,372×1,070 px, 191 KB)

What do you think? @bmartinezcalvo

Just one thing: from the Figma design, it appears that the buttons above have a constant white space padding at their base, This makes them always appear "suspended" especially when the buttons below are in a toggled-on state.

image.png (1,608×890 px, 145 KB)

@EUdoh-WMF due to Figma implementation I can't design the Figma button exactly the same as in the Codex demo, but I've updated the maximum example in the Figma spec to align it more with our demo.

Captura de Pantalla 2022-10-18 a las 13.03.40.png (1,280×410 px, 145 KB)

On the demo page, if a button above and below are toggled-on, it seems the button below is eating into the button above, due to the absence of this white padding.

image.png (2,372×1,070 px, 191 KB)

What do you think? @bmartinezcalvo

It seems that this is happening because the second button row is -1 and the toggled button shadow on top is outside, so visually the button white shadow on top is 2px above the button on top. @Catrope in the Figma buttons I'm using a white inner border on top to solve this, would it be possible to add a white border instead of the shadow-top? I think with this solution we could also solve the 1px empty between the top and the left shadow in the toggled button (on the Fifth button in the following image).

Captura de Pantalla 2022-10-18 a las 13.11.00.png (1,024×510 px, 172 KB)

I resolved the task by mistake. Reopening task again.

It seems that this is happening because the second button row is -1 and the toggled button shadow on top is outside, so visually the button white shadow on top is 2px above the button on top. @Catrope in the Figma buttons I'm using a white inner border on top to solve this, would it be possible to add a white border instead of the shadow-top? I think with this solution we could also solve the 1px empty between the top and the left shadow in the toggled button (on the Fifth button in the following image).

Captura de Pantalla 2022-10-18 a las 13.11.00.png (1,024×510 px, 172 KB)

The problem with using a top border is that it also affects the toggled-on buttons in the top row, which then appear to be 1px shorter than their toggled-off neighbors:

image.png (1,544×216 px, 36 KB)

I also considered making the bottom border white, but that doesn't work because the bottom border is invisible underneath the overlapping button below (because of the negative margin, which is the technical term for the -1 thing), and it would also cause the same height mismatch issue for toggled vs non-toggled buttons in the bottom row. A bottom shadow would not have the second issue, but would still have the first issue.

As commented yesterday during our DST meeting, the problem with this button group is the white separation which makes it impossible for stacked toggled and disabled buttons to look perfect. Since this is the MVP task and we don't know any real use case with stacked button groups at the moment, we will leave this component as we have now (with this white separation that can't be perfect) and we will create a new task to find better possible solutions for stacked buttons.

In this case @EUdoh-WMF this task could be moved to Product Sign-off.

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

[mediawiki/core@master] Update Codex from v0.2.1 to v0.2.2

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

Change 849191 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.2.1 to v0.2.2

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