Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Product name truncated #7502 #9618

Merged
merged 3 commits into from
Jan 9, 2024
Merged

Conversation

TCatinaud
Copy link
Collaborator

What

The product name is truncated due to a fixed height defined in the product link. This allows you to have a list of products with a unified height.

Several solutions are possible (such as using grids), I preferred:

  • keep a fixed height by adapting it to avoid seeing part of the text truncated.
  • use the -webkit-line-clamp property to display 3 points if the text is longer. The latter is still in WD but supported by 97% of browsers and offers gracefull degradation if not supported.

The full product name remains accessible by screen readers and when hovering over the map (via the title attribute of the link).
I also added the line-clamp when JS is activated with the alternative in the link title.

Screenshot

  • JS disabled, before fix:
    7502-js-disabled-ko
  • JS disabled, after fix:
    7502-js-disabled-ok
  • JS disabled, show title:
    7502-js-disabled-ok-title
  • JS enabled, before fix:
    7502-js-enabled-ko
  • JS enabled, after fix:
    7502-js-enabled-ok
  • JS enabled, show title:
    7502-js-enabled-ok-title

Related issue(s) and discussion

@TCatinaud TCatinaud requested a review from a team as a code owner January 4, 2024 10:35
@TCatinaud TCatinaud removed their assignment Jan 4, 2024
@TCatinaud TCatinaud changed the title fix: Product name truncated fix: Product name truncated #7502 Jan 4, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e8cb4f4) 49.28% compared to head (5edcbc6) 49.28%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9618   +/-   ##
=======================================
  Coverage   49.28%   49.28%           
=======================================
  Files          66       66           
  Lines       20546    20546           
  Branches     4946     4946           
=======================================
  Hits        10126    10126           
  Misses       9132     9132           
  Partials     1288     1288           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// Force the height and use line-clamp of the product name so that
// icons below are vertically aligned with other cards on the same line
display: -webkit-box;
-webkit-box-orient: vertical;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be related to the (old?) standard display: box, but box-orient is apparently deprecated according to https://developer.mozilla.org/en-US/docs/Web/CSS/box-orient#browser_compatibility? Or is that related to the W3C draft?

@alexgarel
Copy link
Member

FYI, on firefox 121.0 on ubuntu 23.10:

  • works well without js for me

  • with js, the 4th line is already below the other tile:
    image

@stephanegigandet
Copy link
Contributor

  • with js, the 4th line is already below the other tile:

@alexgarel in fact it depends on the screen width, there is a .v-space-tiny class that gets from 3.5 pixels to 10.5 pixels as the screen grows, but it has no sense here as we put in more columns when the screen grows.. I'll try replacing it with a fixed size instead.

@stephanegigandet
Copy link
Contributor

I removed the v-space-tiny class: it made the padding-top of the text go from 3.5 pixels to 10.5 pixels as the screen grew, resulting on the 4th line being not shown completely when the screen was large.

The 4 lines now always fit:

image

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this change @TCatinaud , it's perfect. :)

@stephanegigandet stephanegigandet enabled auto-merge (squash) January 9, 2024 14:55
Copy link

sonarcloud bot commented Jan 9, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@stephanegigandet stephanegigandet merged commit 53c218f into main Jan 9, 2024
12 checks passed
@stephanegigandet stephanegigandet deleted the product-name-truncated branch January 9, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NEW DESIGN - Product name is truncated (JS disabled only ?)
5 participants