Skip to content

Commit 1eb6c78

Browse files
committed
Fix popover icon fonts and expose font-family variable
1 parent a4f86e4 commit 1eb6c78

3 files changed

Lines changed: 43 additions & 7 deletions

File tree

docs/src/content/guides/changelog.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,23 @@ ships, these entries move under a versioned heading.
1515
- `index` on the options passed to every hook, holding the currently active
1616
step index (same value as `driverObj.getActiveIndex()`).
1717
([#490](https://github.com/nilbuild/driver.js/issues/490))
18+
- `--driver-popover-font-family` CSS variable to set the popover font in one
19+
place, without overriding each text element individually.
20+
([#607](https://github.com/nilbuild/driver.js/issues/607))
21+
22+
### Changed
23+
24+
- The popover title and description now render in the default font stack
25+
(`"Helvetica Neue", …`) instead of the browser's default `sans-serif`. An
26+
internal rule had been shadowing the intended font. Set
27+
`--driver-popover-font-family` to use your own.
1828

1929
### Fixed
2030

31+
- Icon fonts (Material Icons, Font Awesome, etc.) placed inside a step
32+
description are no longer overridden by the popover font and render correctly.
33+
([#510](https://github.com/nilbuild/driver.js/issues/510),
34+
[#512](https://github.com/nilbuild/driver.js/issues/512))
2135
- Each `driver()` call keeps its own config, steps and state, so creating a
2236
second instance no longer overwrites the first.
2337
([#571](https://github.com/nilbuild/driver.js/issues/571))

docs/src/content/guides/theming.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ Here is the list of classes applied to the popover which you can use in conjunct
7575

7676
Visit the [example page](/docs/styling-popover) for an example that modifies the popover styles.
7777

78+
## Custom Font
79+
80+
The popover text uses the following font stack by default:
81+
82+
```css
83+
"Helvetica Neue", Inter, ui-sans-serif, "Apple Color Emoji", Helvetica, Arial, sans-serif;
84+
```
85+
86+
To use your own font, override the `--driver-popover-font-family` CSS variable. It's inherited, so you can set it anywhere above the popover (on `:root`, `body`, or a `popoverClass`) and it applies to the title, description, buttons, and progress text at once.
87+
88+
```css
89+
:root {
90+
--driver-popover-font-family: "Inter", sans-serif;
91+
}
92+
```
93+
7894
## Modifying Popover DOM
7995

8096
Alternatively, you can also use the `onPopoverRender` hook to modify the popover DOM before it is displayed. The hook is called with the popover DOM as the first argument.

src/driver.css

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838
/* Popover styles */
3939
.driver-popover {
4040
all: unset;
41+
font-family: var(
42+
--driver-popover-font-family,
43+
"Helvetica Neue",
44+
Inter,
45+
ui-sans-serif,
46+
"Apple Color Emoji",
47+
Helvetica,
48+
Arial,
49+
sans-serif
50+
);
4151
box-sizing: border-box;
4252
color: #2d2d2d;
4353
margin: 0;
@@ -53,12 +63,8 @@
5363
background-color: #fff;
5464
}
5565

56-
.driver-popover * {
57-
font-family: "Helvetica Neue", Inter, ui-sans-serif, "Apple Color Emoji", Helvetica, Arial, sans-serif;
58-
}
59-
6066
.driver-popover-title {
61-
font: 19px / normal sans-serif;
67+
font-size: 19px;
6268
font-weight: 700;
6369
display: block;
6470
position: relative;
@@ -95,7 +101,7 @@
95101

96102
.driver-popover-description {
97103
margin-bottom: 0;
98-
font: 14px / normal sans-serif;
104+
font-size: 14px;
99105
line-height: 1.5;
100106
font-weight: 400;
101107
zoom: 1;
@@ -125,7 +131,7 @@
125131
text-decoration: none;
126132
background-color: #ffffff;
127133
color: #2d2d2d;
128-
font: 12px / normal sans-serif;
134+
font-size: 12px;
129135
cursor: pointer;
130136
outline: 0;
131137
zoom: 1;

0 commit comments

Comments
 (0)