Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 1154fae

Browse files
ThomasBurlesonCaerusKaru
authored andcommitted
fix(core): update breakpoint ranges to remove subpixel gaps (#1004)
In rare cases, browsers resizing may create viewports with subpixel values. Previous mediaQueries had 1 pixel gaps where the bounding ranges do not match. Update the `max-width` values to include subpixel values and eliminate 99.99% of all gaps. Fixes #1001.
1 parent 1c136bc commit 1154fae

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/lib/core/breakpoints/data/break-points.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,52 @@ import {BreakPoint} from '../break-point';
1313
export const DEFAULT_BREAKPOINTS: BreakPoint[] = [
1414
{
1515
alias: 'xs',
16-
mediaQuery: 'screen and (min-width: 0px) and (max-width: 599px)',
16+
mediaQuery: 'screen and (min-width: 0px) and (max-width: 599.9999px)',
1717
priority: 1000,
1818
},
1919
{
2020
alias: 'sm',
21-
mediaQuery: 'screen and (min-width: 600px) and (max-width: 959px)',
21+
mediaQuery: 'screen and (min-width: 600px) and (max-width: 959.9999px)',
2222
priority: 900,
2323
},
2424
{
2525
alias: 'md',
26-
mediaQuery: 'screen and (min-width: 960px) and (max-width: 1279px)',
26+
mediaQuery: 'screen and (min-width: 960px) and (max-width: 1279.9999px)',
2727
priority: 800,
2828
},
2929
{
3030
alias: 'lg',
31-
mediaQuery: 'screen and (min-width: 1280px) and (max-width: 1919px)',
31+
mediaQuery: 'screen and (min-width: 1280px) and (max-width: 1919.9999px)',
3232
priority: 700,
3333
},
3434
{
3535
alias: 'xl',
36-
mediaQuery: 'screen and (min-width: 1920px) and (max-width: 5000px)',
36+
mediaQuery: 'screen and (min-width: 1920px) and (max-width: 4999.9999px)',
3737
priority: 600,
3838
},
3939
{
4040
alias: 'lt-sm',
4141
overlapping: true,
42-
mediaQuery: 'screen and (max-width: 599px)',
42+
mediaQuery: 'screen and (max-width: 599.9999px)',
4343
priority: 950,
4444
},
4545
{
4646
alias: 'lt-md',
4747
overlapping: true,
48-
mediaQuery: 'screen and (max-width: 959px)',
48+
mediaQuery: 'screen and (max-width: 959.9999px)',
4949
priority: 850,
5050
},
5151
{
5252
alias: 'lt-lg',
5353
overlapping: true,
54-
mediaQuery: 'screen and (max-width: 1279px)',
54+
mediaQuery: 'screen and (max-width: 1279.9999px)',
5555
priority: 750,
5656
},
5757
{
5858
alias: 'lt-xl',
5959
overlapping: true,
6060
priority: 650,
61-
mediaQuery: 'screen and (max-width: 1919px)',
61+
mediaQuery: 'screen and (max-width: 1919.9999px)',
6262
},
6363
{
6464
alias: 'gt-xs',

src/lib/core/media-observer/media-observer.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe('media-observer', () => {
181181
describe('with custom BreakPoints', () => {
182182
const gtXsMediaQuery = 'screen and (min-width:120px) and (orientation:landscape)';
183183
const superXLQuery = 'screen and (min-width:10000px)';
184-
const smMediaQuery = 'screen and (min-width: 600px) and (max-width: 959px)';
184+
const smMediaQuery = 'screen and (min-width: 600px) and (max-width: 959.9999px)';
185185

186186
const CUSTOM_BREAKPOINTS = [
187187
{alias: 'slate.xl', priority: 11000, mediaQuery: superXLQuery},
@@ -236,7 +236,7 @@ describe('media-observer', () => {
236236
});
237237

238238
describe('with layout "print" configured', () => {
239-
const mdMediaQuery = 'screen and (min-width: 960px) and (max-width: 1279px)';
239+
const mdMediaQuery = 'screen and (min-width: 960px) and (max-width: 1279.9999px)';
240240

241241
beforeEach(() => {
242242
// Configure testbed to prepare services
@@ -288,7 +288,7 @@ describe('media-observer', () => {
288288
});
289289

290290
describe('with layout print NOT configured', () => {
291-
const smMediaQuery = 'screen and (min-width: 600px) and (max-width: 959px)';
291+
const smMediaQuery = 'screen and (min-width: 600px) and (max-width: 959.9999px)';
292292

293293
beforeEach(() => {
294294
// Configure testbed to prepare services

src/lib/core/sass/_layout-bp.scss

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
$breakpoints: (
66
xs: (
77
begin: 0,
8-
end: 599px
8+
end: 599.9999px
99
),
1010
sm: (
1111
begin: 600px,
12-
end: 959px
12+
end: 959.9999px
1313
),
1414
md: (
1515
begin: 960px,
16-
end: 1279px
16+
end: 1279.9999px
1717
),
1818
lg: (
1919
begin: 1280px,
20-
end: 1919px
20+
end: 1919.9999px
2121
),
2222
xl: (
2323
begin: 1920px,
24-
end: 5000px
24+
end: 4999.9999px
2525
),
2626
) !default;
2727

@@ -39,10 +39,10 @@ $overlapping-gt: (
3939
// Material Design breakpoints
4040
// @type map
4141
$overlapping-lt: (
42-
lt-sm: 599px,
43-
lt-md: 959px,
44-
lt-lg: 1279px,
45-
lt-xl: 1919px,
42+
lt-sm: 599.9999px,
43+
lt-md: 959.9999px,
44+
lt-lg: 1279.9999px,
45+
lt-xl: 1919.9999px,
4646
) !default;
4747

4848

0 commit comments

Comments
 (0)