Page MenuHomePhabricator

Define and add the expand and collapse (accordion) component to the DSG
Closed, DeclinedPublic

Assigned To
None
Authored By
RHo
Apr 21 2021, 1:13 PM
Referenced Files
F35870067: Captura de Pantalla 2022-12-16 a las 12.24.20.png
Dec 16 2022, 11:25 AM
F35870064: Captura de Pantalla 2022-12-16 a las 12.24.13.png
Dec 16 2022, 11:25 AM
F35565280: image.png
Oct 12 2022, 10:42 PM
F35565282: image.png
Oct 12 2022, 10:42 PM
F35518016: Screen Shot 2022-09-12 at 8.04.41 PM.png
Sep 12 2022, 2:35 PM
F35517591: Screenshot 2022-09-12 at 12.10.54.png
Sep 12 2022, 10:20 AM
F35515082: image.png
Sep 9 2022, 4:26 PM
F35286446: Captura de Pantalla 2022-06-29 a las 14.14.12.png
Jun 29 2022, 12:24 PM
Tokens
"Love" token, awarded by alexhollender_WMF.

Description

Background goal

Define and add the expand and collapse (accordion) component to the DSG

Some examples in use right now:

Minerva content sections collapsed by default
image.png (740×810 px, 37 KB)
Expanded
image.png (810×812 px, 117 KB)
Vector 2022 toc sections (default state depends on # of sections) This is not an accordion but a TreeView instead T325351
Screen Shot 2022-06-27 at 12.45.48 PM.png (537×582 px, 95 KB)
expanded
Screen Shot 2022-06-27 at 12.45.57 PM.png (541×591 px, 101 KB)
Vector Tools panel (Prototype)
Captura de Pantalla 2022-12-16 a las 12.24.13.png (1×1 px, 730 KB)
Expanded
Captura de Pantalla 2022-12-16 a las 12.24.20.png (1×1 px, 713 KB)
Vector table of contents expanded by default
image.png (824×668 px, 79 KB)
Collapsed
image.png (202×464 px, 13 KB)
VE droplist menu
image.png (624×634 px, 67 KB)
VE templates selector (doesn’t enable collapse)
image.png (474×626 px, 62 KB)
Search/filter component on many Special pages
image.png (680×2 px, 276 KB)
Expanded
Screen Shot 2022-09-12 at 8.04.41 PM.png (1×2 px, 181 KB)
Expand/collapse links in legend/key tables on Watchlist and other Special pages
image.png (284×656 px, 95 KB)

Open questions

  • Direction of the arrow when it expands and collapses
  • Position of the expandable/collapsable item (before or after the text?)

Acceptance criteria

  • Collect current implementations across products
  • Define general rules on appearance and interactivity
  • Add to DSG

Event Timeline

Adding designers who have previously discussed this component. Plan is to add this as a subtask to the inventory task T277047.

RHo renamed this task from Define and add the expand and collapse component to the DSG to Define and add the expand and collapse (accordion) component to the DSG.Jun 27 2022, 10:21 AM
RHo updated the task description. (Show Details)

thanks for setting up this task @RHo

  1. should we aim to be consistent regarding the direction of the arrow for expanded/collapsed? I think the pattern we use on mobile web, while non-standard, works quite well (especially in cases where there are multiple collapsed sections/elements stacked on top of each other). I would be happy if we aligned around that. I think the more standard pattern is that the arrow points towards the text/label when collapsed, and then points down when expanded (the evidence I have for that is mainly what I've seen on the web, and also what's natively part of the details tag which seems to be the most direct comparison). To compare:
Standard
collapsedexpanded
Screen Shot 2022-06-27 at 12.51.25 PM.png (668×374 px, 55 KB)
Screen Shot 2022-06-27 at 12.51.56 PM.png (665×373 px, 86 KB)
Screen Shot 2022-06-27 at 12.53.09 PM.png (482×398 px, 72 KB)
Screen Shot 2022-06-27 at 12.53.20 PM.png (473×399 px, 78 KB)
Screen Shot 2022-06-27 at 12.55.10 PM.png (392×727 px, 122 KB)
Screen Shot 2022-06-27 at 12.55.37 PM.png (456×651 px, 46 KB)
Approach currently used on mobile web
collapsedexpanded
Screen Shot 2022-06-27 at 1.00.13 PM.png (666×374 px, 51 KB)
Screen Shot 2022-06-27 at 1.00.21 PM.png (665×373 px, 99 KB)
Screen Shot 2022-06-27 at 12.59.11 PM.png (481×445 px, 84 KB)
Screen Shot 2022-06-27 at 12.59.37 PM.png (476×449 px, 90 KB)
Screen Shot 2022-06-27 at 12.58.05 PM.png (371×609 px, 103 KB)
Screen Shot 2022-06-27 at 12.58.17 PM.png (497×635 px, 49 KB)
  1. (somewhat related to the question above) dropdown menus are a similar element: you click on a thing to toggle the visibility of something else. as such they also have similar arrow indicators. in as far as these elements are similar (or even maybe just variations on the same element), do we want to consider flipping the arrow in dropdown menu handles/triggers when the menu is open? example here

  1. this is more of a note: as mentioned above I believe the closest native HTML element to our "expand and collapse (accordion) component" is the details tag. I mention this mainly because I think it's always important for us to be aware of the standard, native behavior when we're developing our own variations on things. also, on a more technical side, we should think about using this tag once the browser support increases.

Thanks @alexhollender_WMF for breathing life to this task! I've responded below for your specific points but wanted to add DS folks (@bmartinezcalvo @Volker_E @Sarai-WMDE ) for visibility and in case they have plans to integrate/prioritise with Codex work. Also adding @Prtksxna who mentioned another accordion use-case.

thanks for setting up this task @RHo

  1. should we aim to be consistent regarding the direction of the arrow for expanded/collapsed? I think the pattern we use on mobile web, while non-standard, works quite well (especially in cases where there are multiple collapsed sections/elements stacked on top of each other). I would be happy if we aligned around that. I think the more standard pattern is that the arrow points towards the text/label when collapsed, and then points down when expanded (the evidence I have for that is mainly what I've seen on the web, and also what's natively part of the details tag which seems to be the most direct comparison). To compare:
Standard
collapsedexpanded
Screen Shot 2022-06-27 at 12.51.25 PM.png (668×374 px, 55 KB)
Screen Shot 2022-06-27 at 12.51.56 PM.png (665×373 px, 86 KB)
Screen Shot 2022-06-27 at 12.53.09 PM.png (482×398 px, 72 KB)
Screen Shot 2022-06-27 at 12.53.20 PM.png (473×399 px, 78 KB)
Screen Shot 2022-06-27 at 12.55.10 PM.png (392×727 px, 122 KB)
Screen Shot 2022-06-27 at 12.55.37 PM.png (456×651 px, 46 KB)
Approach currently used on mobile web
collapsedexpanded
Screen Shot 2022-06-27 at 1.00.13 PM.png (666×374 px, 51 KB)
Screen Shot 2022-06-27 at 1.00.21 PM.png (665×373 px, 99 KB)
Screen Shot 2022-06-27 at 12.59.11 PM.png (481×445 px, 84 KB)
Screen Shot 2022-06-27 at 12.59.37 PM.png (476×449 px, 90 KB)
Screen Shot 2022-06-27 at 12.58.05 PM.png (371×609 px, 103 KB)
Screen Shot 2022-06-27 at 12.58.17 PM.png (497×635 px, 49 KB)

Interesting point about use in web, as I've definitely seen the latter use-case (arrow pointing down when closed, and pointing up when expanded) more so on mobile apps, because the chevron/arrow pointing left or right has connotations with moving forward or backward in navigation, whereas the down/up is more clearly indicative of expanding downwards/contracting upwards. This would be the reason I prefer aligning on the latter. It also relates better to the dropdown element you mention next.

  1. (somewhat related to the question above) dropdown menus are a similar element: you click on a thing to toggle the visibility of something else. as such they also have similar arrow indicators. in as far as these elements are similar (or even maybe just variations on the same element), do we want to consider flipping the arrow in dropdown menu handles/triggers when the menu is open? example here

Yes, that seems like a good addition to the quiet dropdown component, perhaps particularly if there's more than one of these dropdowns next to each other, flipping the arrow (and possible some other additional active affordance like adding a background colour) could potentially help identify which is the open menu.

  1. this is more of a note: as mentioned above I believe the closest native HTML element to our "expand and collapse (accordion) component" is the details tag. I mention this mainly because I think it's always important for us to be aware of the standard, native behavior when we're developing our own variations on things. also, on a more technical side, we should think about using this tag once the browser support increases.

Agree - though to confirm, if we use <details> moving forward, the decision about what icon to use can still be styled to whatever we choose, right? I had a quick go with the up/down chevrons here: https://codepen.io/reets/pen/eYMOojN

image.png (1×1 px, 281 KB)

Direction of the arrow

@alexhollender_WMF I agree with using the same approach we use in mobile for the direction of the arrow since, as @RHo comments, this solution indicates the expansion (arrow-down) and collapse (arrow-up) and helps the users to know what is going to happen when they click the arrow.

Captura de Pantalla 2022-06-29 a las 14.00.45.png (1×1 px, 1 MB)

FYI in the select component we decided to add the arrow without rotation because in some cases the select needs to open from bottom and in this cases the rotation if the arrow was weird. So we decided to not adding rotation to any select component.

Captura de Pantalla 2022-06-29 a las 14.05.28.png (394×1 px, 429 KB)

Although we decided not to add rotation for selections, I think the accordion component is different because we don't have cases where the accordion opens from below.

Position of the expand/collapse item

I think we should also unify where we want to add the expand/collapse items. In some cases it appears before the text and in other cases after the text.

Captura de Pantalla 2022-06-29 a las 14.14.25.png (112×968 px, 39 KB)

Captura de Pantalla 2022-06-29 a las 14.14.12.png (1×1 px, 572 KB)


I've added these 2 topics in the task description as open questions.

Another future use case is the "collapsible list" in WikiLambda:

image.png (1×1 px, 147 KB)

This will likely use the accordion component, and may become either a project-specific component that wraps Accordion or a reusable Codex component.

The Design System team will start working on an initial standard version of the Accordion component for Abstract Wikipedia (See: T314569). Amin kindly started an exploration while working on their Default component:

Screenshot 2022-09-12 at 12.10.54.png (1×1 px, 113 KB)

We'll try to not only define its anatomy, style, and behavior, but also the specific characteristics that differentiate it from similar components such as tree view (Table of content).

In the Web/DST Offsite the tree view need was resurfaced, in one of the more recent DIP prototypes:

Tree viewAccordion
image.png (830×504 px, 79 KB)
image.png (1×338 px, 82 KB)
bmartinezcalvo closed this task as Declined.EditedOct 3 2023, 3:40 PM
bmartinezcalvo added a subscriber: CCiufo-WMF.

Declining this task since the accordion's guidelines have been defined and implemented in T345656: Component's guidelines: create guidelines for new Codex components. cc: @CCiufo-WMF