Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix css fallback of max function in chrome 76. #6425

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions src/components/alphaPicker/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../styles/mixins';

.alphaPicker {
text-align: center;
display: flex;
Expand All @@ -11,8 +13,8 @@

.alphaPicker-fixed {
position: fixed;
bottom: 5.5em;
bottom: max(env(safe-area-inset-bottom), 5.5em);

@include conditional-max(bottom, 5.5em, env(safe-area-inset-bottom));
}

.alphaPickerRow {
Expand Down Expand Up @@ -45,8 +47,7 @@

@media all and (max-height: 50em) {
.alphaPicker-fixed {
bottom: 5em;
bottom: max(env(safe-area-inset-bottom), 5em);
@include conditional-max(bottom, 5em, env(safe-area-inset-bottom));
}

.alphaPickerButton-vertical {
Expand Down Expand Up @@ -105,32 +106,27 @@
}

.alphaPicker-fixed.alphaPicker-tv {
bottom: 1%;
bottom: max(env(safe-area-inset-bottom), 1%);
@include conditional-max(bottom, 1%, env(safe-area-inset-bottom));
}

.alphaPicker-fixed-right {
[dir="ltr"] & {
right: 0.4em;
right: max(env(safe-area-inset-right), 0.4em);
@include conditional-max(right, 0.4em, env(safe-area-inset-right));
}

[dir="rtl"] & {
left: 0.4em;
left: max(env(safe-area-inset-left), 0.4em);
@include conditional-max(left, 0.4em, env(safe-area-inset-left));
}
}

@media all and (min-width: 62.5em) {
.alphaPicker-fixed-right {
[dir="ltr"] & {
right: 1em;
right: max(env(safe-area-inset-right), 1em);
@include conditional-max(right, 1em, env(safe-area-inset-right));
}

[dir="rtl"] & {
left: 1em;
left: max(env(safe-area-inset-left), 1em);
@include conditional-max(left, 1em, env(safe-area-inset-left));
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/components/multiSelect/multiSelect.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import '../../styles/mixins';

.itemSelectionPanel {
position: absolute;
Expand All @@ -14,16 +15,14 @@
top: 0;
left: 0;
right: 0;
padding-left: 0.5em;
padding-left: max(env(safe-area-inset-left), 0.5em);
padding-right: 0.5em;
padding-right: max(env(safe-area-inset-right), 0.5em);
padding-top: 1em;
padding-top: max(env(safe-area-inset-top), 1em);
padding-bottom: 1em;
display: flex;
align-items: center;
z-index: 99999;

@include conditional-max(padding-left, 0.5em, env(safe-area-inset-left));
@include conditional-max(padding-right, 0.5em, env(safe-area-inset-right));
@include conditional-max(padding-top, 1em, env(safe-area-inset-top));
}

.itemSelectionCount {
Expand Down
9 changes: 5 additions & 4 deletions src/components/remotecontrol/remotecontrol.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../styles/mixins';

.nowPlayingPage {
padding: 5em 0 0 0 !important;
}
Expand Down Expand Up @@ -184,11 +186,10 @@
left: 0;
height: 4.2em;
right: 0;
padding-left: 7.3%;
padding-left: max(env(safe-area-inset-left), 7.3%);
padding-right: 7.3%;
padding-right: max(env(safe-area-inset-right), 7.3%);
padding-bottom: env(safe-area-inset-bottom);

@include conditional-max(padding-left, 7.3%, env(safe-area-inset-left));
@include conditional-max(padding-right, 7.3%, env(safe-area-inset-right));
}

.layout-desktop .playlistSectionButton,
Expand Down
9 changes: 5 additions & 4 deletions src/components/toast/toast.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
@import '../../styles/mixins';

.toastContainer {
position: fixed;
bottom: 0;
pointer-events: none;
z-index: 9999999;
padding-left: 1em;
padding-left: max(env(safe-area-inset-left), 1em);
padding-right: 1em;
padding-top: 1em;
padding-bottom: 1em;
padding-bottom: max(env(safe-area-inset-bottom), 1em);
display: flex;
flex-direction: column;

@include conditional-max(padding-left, 1em, env(safe-area-inset-left));
@include conditional-max(padding-bottom, 1em, env(safe-area-inset-bottom));

[dir="ltr"] & {
left: 0;
}
Expand Down
8 changes: 4 additions & 4 deletions src/elements/emby-scroller/emby-scroller.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@import '../../styles/mixins';

.emby-scroller-container {
position: relative;
}

.emby-scroller {
padding-left: 3.3%;
padding-left: max(env(safe-area-inset-left), 3.3%);
padding-right: 3.3%;
padding-right: max(env(safe-area-inset-right), 3.3%);
@include conditional-max(padding-left, 3.3%, env(safe-area-inset-left));
@include conditional-max(padding-right, 3.3%, env(safe-area-inset-right));
}

.servers > .card > .cardBox {
Expand Down
12 changes: 12 additions & 0 deletions src/styles/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This mixin is used to provide a fallback for `max()` function in older browsers
// (e.g. Chrome 76 that is found in devices like Samsung 2021 TVs). The mixin ensures
// a default value is applied to a property while using `max()` only if supported.
@mixin conditional-max($property, $default, $max-value) {
& {
#{$property}: $default;
}

@supports (width: max(1px, 1px)) {
#{$property}: max($max-value, $default);
}
}
20 changes: 8 additions & 12 deletions src/styles/librarybrowser.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import 'mixins';

// The padding of the header content on mobile needs to be adjusted
// based on the size of the poster card (values from card.scss)
@mixin header-poster-padding() {
Expand Down Expand Up @@ -1353,25 +1355,21 @@ div:not(.sectionTitleContainer-cards) > .sectionTitle-cards {

.padded-left {
[dir="ltr"] & {
padding-left: 3.3%;
padding-left: max(env(safe-area-inset-left), 3.3%);
@include conditional-max(padding-left, 3.3%, env(safe-area-inset-left));
}

[dir="rtl"] & {
padding-right: 3.3%;
padding-right: max(env(safe-area-inset-right), 3.3%);
@include conditional-max(padding-right, 3.3%, env(safe-area-inset-right));
}
}

.padded-right {
[dir="ltr"] & {
padding-right: 3.3%;
padding-right: max(env(safe-area-inset-right), 3.3%);
@include conditional-max(padding-right, 3.3%, env(safe-area-inset-right));
}

[dir="rtl"] & {
padding-left: 3.3%;
padding-left: max(env(safe-area-inset-left), 3.3%);
@include conditional-max(padding-left, 3.3%, env(safe-area-inset-left));
}
}

Expand All @@ -1395,13 +1393,11 @@ div:not(.sectionTitleContainer-cards) > .sectionTitle-cards {

@media all and (min-height: 31.25em) {
[dir="ltr"] .padded-right-withalphapicker {
padding-right: 7.5%;
padding-right: max(env(safe-area-inset-right), 7.5%);
@include conditional-max(padding-right, 7.5%, env(safe-area-inset-right));
}

[dir="rtl"] .padded-right-withalphapicker {
padding-left: 7.5%;
padding-left: max(env(safe-area-inset-left), 7.5%);
@include conditional-max(padding-left, 7.5%, env(safe-area-inset-left));
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/styles/videoosd.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import 'mixins';

.chapterThumbTextContainer,
.videoOsdBottom {
user-select: none;
Expand All @@ -12,8 +14,6 @@
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
padding-top: 7.5em;
padding-bottom: 1.75em;
padding-bottom: max(env(safe-area-inset-bottom), 1.75em);
display: flex;
flex-direction: row;
justify-content: center;
Expand All @@ -23,6 +23,8 @@
user-select: none;
-webkit-touch-callout: none;
pointer-events: none;

@include conditional-max(padding-bottom, 1.75em, env(safe-area-inset-bottom));
}

.skinHeader-withBackground.osdHeader {
Expand Down
Loading