Skip to content

Commit

Permalink
feat(popup): multiline tooltip variation
Browse files Browse the repository at this point in the history
This PR allows multiline tooltips via new multiline variation to be set in data-variation.
However the data-tooltip text has to be cleverly prepared to make this work completely.

- non breaking spaces have to use a non visible character like U+A0 (see https://qwerty.dev/whitespace/)
- newlines to break lines / trigger a tooltip newline

https://jsfiddle.net/lubber/Lk2sp8nq/15/
  • Loading branch information
lubber-de authored Nov 17, 2022
1 parent d296b9a commit 6dae584
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/definitions/modules/popup.less
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@
display: none;
}
}

& when (@variationPopupMultiline) {
[data-tooltip][data-variation~="multiline"]::after {
white-space: @multilineWhiteSpace;
}
}
}

/*--------------
Expand Down
1 change: 1 addition & 0 deletions src/themes/default/globals/variation.variables
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@
@variationPopupFluid: true;
@variationPopupFlowing: true;
@variationPopupFixed: true;
@variationPopupMultiline: true;
@variationPopupSizes: @variationAllSizes;
@variationPopupColors: @variationAllColors;

Expand Down
2 changes: 2 additions & 0 deletions src/themes/default/modules/popup.variables
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
Variations
--------------------*/

@multilineWhiteSpace: pre-line;

/* Wide */
@wideWidth: 350px;
@veryWideWidth: 550px;
Expand Down

0 comments on commit 6dae584

Please sign in to comment.