Page MenuHomePhabricator

Button text overflows the button's borders and does not have the correct padding
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
EUdoh-WMF
Jun 2 2022, 11:48 PM
Referenced Files
F35284016: image.png
Jun 28 2022, 2:43 PM
F35283998: image.png
Jun 28 2022, 2:43 PM
F35284010: image.png
Jun 28 2022, 2:43 PM
F35222789: image.png
Jun 9 2022, 4:52 PM
F35222780: image.png
Jun 9 2022, 4:52 PM
F35222774: image.png
Jun 9 2022, 4:52 PM
F35218977: Captura de pantalla 2022-06-08 a las 15.54.52.png
Jun 8 2022, 1:59 PM
F35218974: Captura de pantalla 2022-06-08 a las 15.50.18.png
Jun 8 2022, 1:59 PM

Description

Background

List of steps to reproduce:

  • Open the Codex Demo page and navigate to the Button component's Demo section
  • In the "default" text section, enter a long sentence, such as "This is the story all about how my life got twisted up and down and then we are"

What happens?:

  • The text extends beyond the button's borders.

When a button's content is longer than the max-width set via CSS, the text overflows the button element:

image.png (128×1 px, 21 KB)

You can see another example of this in the new dialog component:

image.png (226×1 px, 29 KB)

What should have happened instead?:

  • The text should have been truncated when the button's maximum width had been reached.

We should update this to hide overflow with an ellipsis or something.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

  • Detected using Chrome v102 on Firefox v101

Monterey 12.0.1

image.png (946×1 px, 195 KB)

  • On Safari 15.1, the text is truncated, however it is not centralized on the button as per the requirements. There should be equal padding at both ends of the button.

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

Acceptance criteria (or Done)

  • Ellipsis appears when text is longer than max-width

Event Timeline

EUdoh-WMF renamed this task from Button text overflows the button's borders to Button text overflows the button's borders and does not have the correct padding.Jun 2 2022, 11:52 PM
EUdoh-WMF updated the task description. (Show Details)
SimoneThisDot changed the task status from Open to In Progress.Jun 7 2022, 12:20 PM
SimoneThisDot claimed this task.

Change 803493 had a related patch set uploaded (by Simone Cuomo; author: Simone Cuomo):

[design/codex@main] Button, ToggleButton: Text overflow from button is larger than max width

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

Change 803493 merged by jenkins-bot:

[design/codex@main] Button, ToggleButton: Text overflow from button is larger than max width

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

Design sign-off done. Ellipsis appears when text is long.

Captura de pantalla 2022-06-08 a las 15.50.18.png (516×1 px, 54 KB)

Although ellipsis appears when text is long, I've found some things to fix:

  1. Ellipsis appears when text is longer than 53 characters. It should appears when the button has reached its available max-width, and in this case the button is not filling demo box width.

Captura de pantalla 2022-06-08 a las 15.54.52.png (376×2 px, 468 KB)

  1. Also, the ellipsis doesn't adapt to each button width because the button is not filling the demo box but is displayed with a fixed width. Fir this reason, the button stands out the demo box when you resize the screen.

Captura de pantalla 2022-06-08 a las 15.55.26.png (628×1 px, 214 KB)

@SimoneThisDot I move the task to Ready for Development so you can have a look.

@bmartinezcalvo I noticed the same thing and decided to open a separate task, since these issues are caused by the button's current max-width, which I figured would require some discussion: T310158

Please feel free to comment on that new task if you have thoughts about how to handle this!

@bmartinezcalvo I noticed the same thing and decided to open a separate task, since these issues are caused by the button's current max-width, which I figured would require some discussion: T310158

Please feel free to comment on that new task if you have thoughts about how to handle this!

@AnneT thank you for the information, I will review the new task.


@SimoneThisDot as my corrections collected in my previous comment are related with the button width (topic moved to this other task T310158) you can ignore them because the rest is working well in the component. So I move the task to Functional Testing since the design sign-off was done.

For completion on an i18n detail for overflow elements: https://en.wikipedia.org/wiki/Ellipsis#In_different_languages
According to above article in Chinese the ellipsis is “……”, which we're not covering (and can't) with the .text-overflow mixin currently.
My personal take was to continue to use three dot ellipsis (but one char!) for now and know about and accept the imperfect internationalization status quo.

Hi @bmartinezcalvo @SimoneThisDot I had a look at this again and the overflow issue has been fixed. However, it seems the width on Firefox is slightly different from other browsers and truncates a character before the others do. The text I used in this case is:

Click me but do not tell me what happens when you overstimate

Chrome 102:

image.png (514×1 px, 75 KB)

Safari 15.1:

image.png (390×1 px, 60 KB)

Firefox 101.0.1:

image.png (366×1 px, 310 KB)

I think that might be because the font Firefox uses is slightly larger/wider? I feel like we see subtle differences like that with Firefox pretty often. @Volker_E probably knows more.

NBaca-WMF added subscribers: SimoneThisDot, NBaca-WMF.

Setting Owner to Ezekiel for QTE Sign-off

As I mentioned during our "pair testing" session, this seems to be browser-related as I could not see any difference in the values of the component.

The difference is also not providing any "degradation" to the different browsers, so I do not think further development should be considered here (as they will prob result in hacks of some sort)

Thanks for your comments! Moving this to Product Sign-Off.

I think that might be because the font Firefox uses is slightly larger/wider? I feel like we see subtle differences like that with Firefox pretty often. @Volker_E probably knows more.

This is a known issue with Firefox macOS: It uses 'Helvetica' as 'sans-serif' which is different to all other macOS browsers, who use 'San Francisco' (in CSS -apple-system)

"Helvetica""Helvetica Neue""San Francisco"/-apple-system
image.png (676×982 px, 96 KB)
image.png (656×980 px, 97 KB)
image.png (700×980 px, 99 KB)

I've even filed a Firefox bug a while ago, cause for layout the default choice f*** sucks, specifically on the letter box issue, making the font never look vertically centered. But all of this doesn't stop this task from being moved to Product Sign-Off. @EUdoh-WMF pls take those font differences in account for future component testing, differences will remain.