Skip to content

Commit e12322f

Browse files
fix(frontend): roboto font loading DEV-887 (#6199)
### 💭 Notes Firefox has a feature that protects users from being targeted using their available system fonts. This feature causes our Roboto font to not be properly loaded when using Private browsing. I'm updating the way in which we load Roboto to avoid the problem. ### 👀 Preview steps 1. Use Private browsing in Firefox 2. Open any KPI route (don't even need to be logged in) 3. 🔴 [on main] notice that the font used is the default sans-serif browser font 4. 🟢 [on PR] notice that the font used is Roboto ℹ️ The easiest way is to use Dev Tools, and in "Inspector" tab selecting "Fonts" sub-tab on the right. "All Fonts on Page" should list only `k-icons` and few different `Roboto` (all comming from `/static/compiled/…`). --------- Co-authored-by: Paulo Amorim <[email protected]>
1 parent e90401d commit e12322f

File tree

5 files changed

+14
-127
lines changed

5 files changed

+14
-127
lines changed

jsapp/js/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
*/
1111
import 'jquery-ui/ui/widgets/sortable'
1212
import '@mantine/core/styles.css'
13+
// We import all the weights and styles we actually use here to avoid unnecessary weight (pun intended).
14+
import '@fontsource/roboto/400.css'
15+
import '@fontsource/roboto/400-italic.css'
16+
import '@fontsource/roboto/500.css'
17+
// Roboto doesn't have semibold (600) version. We do use 600 font weight a lot in our styles, but they all are rendered
18+
// as weight 700. To have true 600, we would need to switch to variable font Roboto Flex - but this would require more
19+
// refactor, and AFAIK would also not play nicely with Mantine which uses "Roboto" as default font and doesn't seem
20+
// ready for using a variable font.
21+
// import '@fontsource/roboto/600.css'
22+
import '@fontsource/roboto/700.css'
1323
import '../scss/main.scss'
1424

1525
import React from 'react'

jsapp/scss/fonts/_roboto.scss

Lines changed: 0 additions & 123 deletions
This file was deleted.

jsapp/scss/main.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
@include meta.load-css('./libs/mdl');
88

9-
@include meta.load-css('./fonts/roboto');
109
@include meta.load-css('../fonts/k-icons');
1110

1211
@include meta.load-css('/node_modules/alertifyjs/build/css/alertify.css');

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"node": "^20.18.1 || ^22.4.1"
77
},
88
"dependencies": {
9-
"@fontsource/roboto": "^4.4.2",
9+
"@fontsource/roboto": "^4.5.8",
1010
"@fontsource/roboto-mono": "^4.4.2",
1111
"@mantine/core": "^7.15.0",
1212
"@mantine/form": "^7.16.2",

0 commit comments

Comments
 (0)