Page MenuHomePhabricator

Share Highlight: fix font size issues eg. early truncation and smallest font size
Closed, DeclinedPublic1 Estimated Story PointsBUG REPORT

Description

Font size issues reported via design review {T424591#11918253}

Font size doesn't decrease before truncation in non-image cards. Truncation should only happen when the font is the minimum size and there still isn't enough space.

the smallest font size is too small. Minimum size should be 14px.

Event Timeline

lwatson changed the task status from Open to In Progress.Wed, May 13, 11:15 PM
lwatson claimed this task.

Notes:

  • The dynamic font scaling was updated in one of the loading state patches (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ReaderExperiments/+/1286456/1/resources/experiments/shareHighlight/components/QuoteCard.vue), and backported on May 13th (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ReaderExperiments/+/1286456), so it didn't land in production yet.
  • Dynamic font scaling: The current implementation uses a character count heuristic to adjust font sizes. While the approach is lightweight for an experiment, it doesn't provide a guaranteed safeguard against truncation because it fails to account for rendered line height, container width, or character width. Text can be truncated at the large or medium font size if 7 lines at that size isn't enough space.
  • Current logic:
    • Text with more than 400 characters is size small (0.875rem). The minimum font size is 14px.
    • Text with more than 300 characters is size medium (1rem)
    • Text with more than 0 characters is size x-large (1.25rem). This should probably change from x-large to large (1.125rem).
  • To improve the current code and ensure a minimum font size then truncate approach, we'd need JavaScript to detect overflow (scrollHeight > clientHeight) at the current font size, then decrease the font, and only truncate at the smallest size.
  • Next step is to check on production wiki and decide if the current approach is good enough. Otherwise, implement the JavaScript approach.

@JScherer-WMF Talked about this and we've decided that it was not pervasive enough to be an issue. Proposing to close this.