Skip to content

Commit a6f118a

Browse files
committed
Fix word wrap in tooltips
1 parent 2223a3e commit a6f118a

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/components/Tooltip/client/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const TOOLTIP_HOST_CLASSES = 'relative inline-flex'
1212
const TOOLTIP_TRIGGER_CLASSES =
1313
'inline-flex items-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-spotlight'
1414
const TOOLTIP_POPUP_CLASSES =
15-
'pointer-events-none absolute left-0 top-full z-(--z-content-floating) mt-2 hidden max-w-64 rounded-md border border-trim bg-page-inverse px-2 py-1 text-sm leading-tight text-page-base shadow-elevated'
15+
'pointer-events-none absolute left-0 top-full z-(--z-content-floating) mt-2 hidden max-w-64 rounded-md border border-trim bg-page-inverse px-2 py-1 text-sm leading-tight text-page-base shadow-elevated whitespace-nowrap'
1616

1717
let tooltipIdCounter = 0
1818
let pageLoadListenerAttached = false

src/components/Tooltip/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const shouldRenderWrapper = typeof text === 'string' && text.trim().length > 0
3636
role="tooltip"
3737
aria-hidden="true"
3838
class:list={[
39-
'pointer-events-none absolute left-0 top-full z-(--z-content-floating) mt-2 hidden max-w-64 rounded-md border border-trim bg-page-inverse px-2 py-1 text-sm leading-tight text-page-base shadow-elevated',
39+
'pointer-events-none absolute left-0 top-full z-(--z-content-floating) mt-2 hidden max-w-64 rounded-md border border-trim bg-page-inverse px-2 py-1 text-sm leading-tight text-page-base shadow-elevated whitespace-nowrap',
4040
tooltipClass,
4141
]}
4242
>

src/styles/typography.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@
9999
color: var(--color-secondary);
100100
}
101101

102+
/** Tooltip-backed markdown abbreviations keep their dotted underline affordance. */
103+
abbr[data-tooltip] {
104+
text-decoration-line: underline;
105+
text-decoration-style: dotted;
106+
text-underline-offset: 4px;
107+
}
108+
102109
/** Ensure proper font weight for bold elements */
103110
b,
104111
strong {

0 commit comments

Comments
 (0)