Page MenuHomePhabricator

Buttons: limit text length with ellipsis when it exceeds the maximum
Open, Stalled, LowPublic

Description

Background goal

The way in which text truncation is handled by Codex buttons doesn't make them fully ready for all scenarios. Particularly those involving especially long translations in narrow screens. In said cases, Codex buttons (as their OOUI ancestors) will overflow their layout.

Screenshot 2023-06-01 at 16.26.01.png (290×852 px, 27 KB)

As decided in T359636: Define an approach to content overflow in Codex components, Button and Select will be a maximum of one text line and use ellipsis truncation in case the text exceeds. The Button's entire text will appear as a Tooltip when hovering the Button.

Considerations

  • This issue originally came from a OOUI task (T165870#8879237): It is not only a matter of removing the property white-space: nowrap; as it appears that, in order to bypass the no-wrap behavior of the OOUI button, we'd have to write separate style modules each time. (see T165870 and T165870#8891653 for further context). Is there any way to fix this also in OOUI in a centralized way?
  • In case we provide a wrapping property, then we should make sure to document the cases in which this prop would be useful, and to indicate that the primary recommendation is to keep buttons' text clear, concise and action-oriented.

Acceptance criteria (or Done)

  • Define the best approach for content overflow in Codex T359636

Design

  • Update the Button component using ellipsis truncation in the Codex Figma library
  • Include maximum limitations in the Button Guidelines

Code

  • Update the Button component in Codex using ellipsis truncation

Event Timeline

Manuel updated the task description. (Show Details)
Sarai-WMDE renamed this task from Make it more convenient to allow button wrapping in Codex to [Needs discussion] Define a text truncation approach for buttons that prevents overflow.Jun 1 2023, 3:12 PM
Sarai-WMDE updated the task description. (Show Details)
Sarai-WMDE updated the task description. (Show Details)

Thanks for creating this, @Manuel @Sarai-WMDE! DST will review and reply with next steps by 7 June.

Related to T310158 - we might want to merge these tasks if they serve the same goal.

Not an urgent fix, but still need to decide on priority.

CCiufo-WMF renamed this task from [Needs discussion] Define a text truncation approach for buttons that prevents overflow to Define a text truncation approach for buttons that prevents overflow.Jun 30 2023, 10:31 PM
CCiufo-WMF renamed this task from Define a text truncation approach for buttons that prevents overflow to Buttons: Define a text truncation approach for buttons that prevents overflow.
CCiufo-WMF updated the task description. (Show Details)
CCiufo-WMF changed the task status from Open to Stalled.Mar 8 2024, 3:38 PM
CCiufo-WMF moved this task from Design Upcoming to Backlog on the Design-System-Team board.
CCiufo-WMF subscribed.

Moving to the backlog until we resolve T359636.

As decided in T359636: Define an approach to content overflow in Codex components, Button and Select will be a maximum of one text line and use ellipsis truncation in case the text exceeds. The Button's entire text will appear as a Tooltip when hovering the Button.

Why was that decided for all contexts, and not just for contexts where there is no other possible solution? I’d like to remind that there are no tooltips on mobile, for example.

El T337865#9791057, @stjn escribió:

Why was that decided for all contexts, and not just for contexts where there is no other possible solution? I’d like to remind that there are no tooltips on mobile, for example.

@stjn as documented in T359636: Define an approach to content overflow in Codex components, wrapping will be used as the base solution for content overflow. However, an ellipse will be used to maintain consistency when component height is essential. This means, we will use ellipse truncation for Button, Select, and Chips in order to prevent inconsistencies in height when they are placed next to each other. Since the recommendation is to use as short text as possible in Buttons, and they have a max-width of 448px, the ellipse truncation in Button should be visible just in extreme cases (possible on small mobile devices). A tooltip will make the text visible in those remote cases, and we could use a native tooltip until T340456: Tooltip: Add Tooltip component to Codex is completed. On mobile, the tooltip could be displayed by pressing the Button

OK, that answers my question I think. Hopefully the use of ellipsis will be as minimal as possible.

CCiufo-WMF renamed this task from Buttons: Define a text truncation approach for buttons that prevents overflow to Buttons: limit text length with ellipsis when it exceeds the maximum.Tue, May 14, 9:08 PM