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

Commit 31cb34e

Browse files
theKaleidCaerusKaru
authored andcommitted
fix(core): update breakpoints ranges to avoid overlapping (#1075)
In Chrome, .99 is treated as 1 which cause ranges to overlap at the exact breakpoint. > Note: the behavior might not be considered as a bug in chrome as in [W3 specifications](https://www.w3.org/TR/mediaqueries-4/#mq-min-max) it's mentioned that for sub-pixels or fractions it's preferred to use [the not widely supported range context](https://www.w3.org/TR/mediaqueries-4/#range-context). Fixes #1052. Affects #1001.
1 parent 9f11c88 commit 31cb34e

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

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

Lines changed: 9 additions & 9 deletions
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: 599.99px)',
16+
mediaQuery: 'screen and (min-width: 0px) and (max-width: 599.9px)',
1717
priority: 1000,
1818
},
1919
{
2020
alias: 'sm',
21-
mediaQuery: 'screen and (min-width: 600px) and (max-width: 959.99px)',
21+
mediaQuery: 'screen and (min-width: 600px) and (max-width: 959.9px)',
2222
priority: 900,
2323
},
2424
{
2525
alias: 'md',
26-
mediaQuery: 'screen and (min-width: 960px) and (max-width: 1279.99px)',
26+
mediaQuery: 'screen and (min-width: 960px) and (max-width: 1279.9px)',
2727
priority: 800,
2828
},
2929
{
3030
alias: 'lg',
31-
mediaQuery: 'screen and (min-width: 1280px) and (max-width: 1919.99px)',
31+
mediaQuery: 'screen and (min-width: 1280px) and (max-width: 1919.9px)',
3232
priority: 700,
3333
},
3434
{
3535
alias: 'xl',
36-
mediaQuery: 'screen and (min-width: 1920px) and (max-width: 4999.99px)',
36+
mediaQuery: 'screen and (min-width: 1920px) and (max-width: 4999.9px)',
3737
priority: 600,
3838
},
3939
{
4040
alias: 'lt-sm',
4141
overlapping: true,
42-
mediaQuery: 'screen and (max-width: 599.99px)',
42+
mediaQuery: 'screen and (max-width: 599.9px)',
4343
priority: 950,
4444
},
4545
{
4646
alias: 'lt-md',
4747
overlapping: true,
48-
mediaQuery: 'screen and (max-width: 959.99px)',
48+
mediaQuery: 'screen and (max-width: 959.9px)',
4949
priority: 850,
5050
},
5151
{
5252
alias: 'lt-lg',
5353
overlapping: true,
54-
mediaQuery: 'screen and (max-width: 1279.99px)',
54+
mediaQuery: 'screen and (max-width: 1279.9px)',
5555
priority: 750,
5656
},
5757
{
5858
alias: 'lt-xl',
5959
overlapping: true,
6060
priority: 650,
61-
mediaQuery: 'screen and (max-width: 1919.99px)',
61+
mediaQuery: 'screen and (max-width: 1919.9px)',
6262
},
6363
{
6464
alias: 'gt-xs',

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
import {BreakPoint} from '../break-point';
1010

1111
/* tslint:disable */
12-
const HANDSET_PORTRAIT = '(orientation: portrait) and (max-width: 599.99px)';
13-
const HANDSET_LANDSCAPE = '(orientation: landscape) and (max-width: 959.99px)';
12+
const HANDSET_PORTRAIT = '(orientation: portrait) and (max-width: 599.9px)';
13+
const HANDSET_LANDSCAPE = '(orientation: landscape) and (max-width: 959.9px)';
1414

15-
const TABLET_PORTRAIT = '(orientation: portrait) and (min-width: 600px) and (max-width: 839.99px)';
16-
const TABLET_LANDSCAPE = '(orientation: landscape) and (min-width: 960px) and (max-width: 1279.99px)';
15+
const TABLET_PORTRAIT = '(orientation: portrait) and (min-width: 600px) and (max-width: 839.9px)';
16+
const TABLET_LANDSCAPE = '(orientation: landscape) and (min-width: 960px) and (max-width: 1279.9px)';
1717

1818
const WEB_PORTRAIT = '(orientation: portrait) and (min-width: 840px)';
1919
const WEB_LANDSCAPE = '(orientation: landscape) and (min-width: 1280px)';

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

Lines changed: 3 additions & 3 deletions
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: 959.99px)';
184+
const smMediaQuery = 'screen and (min-width: 600px) and (max-width: 959.9px)';
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: 1279.99px)';
239+
const mdMediaQuery = 'screen and (min-width: 960px) and (max-width: 1279.9px)';
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: 959.99px)';
291+
const smMediaQuery = 'screen and (min-width: 600px) and (max-width: 959.9px)';
292292

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

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
$breakpoints: (
66
xs: (
77
begin: 0,
8-
end: 599.99px
8+
end: 599.9px
99
),
1010
sm: (
1111
begin: 600px,
12-
end: 959.99px
12+
end: 959.9px
1313
),
1414
md: (
1515
begin: 960px,
16-
end: 1279.99px
16+
end: 1279.9px
1717
),
1818
lg: (
1919
begin: 1280px,
20-
end: 1919.99px
20+
end: 1919.9px
2121
),
2222
xl: (
2323
begin: 1920px,
@@ -39,10 +39,10 @@ $overlapping-gt: (
3939
// Material Design breakpoints
4040
// @type map
4141
$overlapping-lt: (
42-
lt-sm: 599.99px,
43-
lt-md: 959.99px,
44-
lt-lg: 1279.99px,
45-
lt-xl: 1919.99px,
42+
lt-sm: 599.9px,
43+
lt-md: 959.9px,
44+
lt-lg: 1279.9px,
45+
lt-xl: 1919.9px,
4646
) !default;
4747

4848

0 commit comments

Comments
 (0)