Skip to content

Commit

Permalink
WEBDEV-5800 Fix 3-line truncation of list tiles in Safari (#220)
Browse files Browse the repository at this point in the history
* Wrap truncated segments with inline element to fix Safari

* Remove margins that circumvent the fix

* Fix tests to work with added element

* Apply margins in a re-render because Safari is weird

* Workaround truncation approach for Safari

* Remove unnecessary wrapper elements

* Revert tests to original DOM structure
  • Loading branch information
latonv authored Jan 25, 2023
1 parent dfe4a67 commit 4689c20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tiles/list/tile-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,12 @@ export class TileList extends LitElement {
word-break: break-word;
-webkit-line-clamp: 3; /* number of lines to show */
line-clamp: 3;
/*
* Safari doesn't always respect the line-clamping rules above,
* so we add this to ensure these fields still get truncated
*/
max-height: 60px;
}
#collections {
Expand Down
6 changes: 6 additions & 0 deletions src/tiles/text-snippet-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export class TextSnippetBlock extends LitElement {
padding-left: 15px;
font-size: 1.4rem;
line-height: 2rem;
/*
* Safari doesn't always respect the line-clamping rules,
* so we add this to ensure these fields still get truncated.
*/
max-height: 6rem;
}
mark {
Expand Down

0 comments on commit 4689c20

Please sign in to comment.