Skip to content

Commit 7797909

Browse files
committed
♿️(styles) use em-based media queries for high text-only zoom
One huge advantage of using em-based MQs is that it auto-solves one big thing that is quite annoying to solve otherwise: high text-only zoom. For RGAA's compliance, we need to have a visually OK website with text-only zoom at 200%. Bootstrap itself had this debate multiple times and ended up sticking with pixels, in my point of view, without a convincing reason (see for example twbs/bootstrap#17403).
1 parent 7c2fb2c commit 7797909

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
2323
- Improve overall accessibility, especially for screen reader users,
2424
on all content pages: category list, category details, blogpost list,
2525
blogpost details, program list, program details, organization detail.
26+
- Use `em` based media queries instead of `px` based media queries to fix all
27+
UI bugs when using the website with a huge text-only zoom
2628

2729
### Fixed
2830

src/frontend/scss/settings/_variables.scss

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@ $onepixel: 0.0625rem;
1010
// Add a new breakpoint "xxl" for more granular downgrading
1111
$grid-breakpoints: (
1212
xs: 0,
13-
sm: 576px,
14-
md: 768px,
15-
lg: 992px,
16-
xl: 1200px,
17-
xxl: 1900px,
13+
sm: em-calc(576px),
14+
md: em-calc(768px),
15+
lg: em-calc(992px),
16+
xl: em-calc(1200px),
17+
xxl: em-calc(1900px),
1818
);
1919

2020
// Add max width for "xxl" breakpoint
2121
$container-max-widths: (
22-
sm: 540px,
23-
md: 720px,
24-
lg: 960px,
25-
xl: 1140px,
26-
xxl: 1240px,
22+
sm: rem-calc(540px),
23+
md: rem-calc(720px),
24+
lg: rem-calc(960px),
25+
xl: rem-calc(1140px),
26+
xxl: rem-calc(1240px),
2727
);
2828

2929
// More space between columns
30-
$grid-gutter-width: 20px;
30+
$grid-gutter-width: rem-calc(20px);
3131

3232
// Base body
3333
$body-color: r-theme-val(body-content, base-color);

src/frontend/scss/tools/_rem.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ $rem-calc-base-font-size: 16px !default;
1616
$remSize: math.div($size, $rem-calc-base-font-size);
1717
@return $remSize * 1rem;
1818
}
19+
20+
@function em-calc($size) {
21+
$emSize: math.div($size, $rem-calc-base-font-size);
22+
@return $emSize * 1em;
1923
}

0 commit comments

Comments
 (0)