fix(vertical-filmstrip): allow overflow scrolling on firefox, edge, and ie

Using column-reverse prevents proper scrolling on browsers other than Safari
and Chrome. Additionally, Firefox has an issue where flex containers have
dimensions set to auto, preventing resize. So, add hacks to maintain Chrome
and Safari's behavior while allowing for some kind of scrolling on other
browsers.
This commit is contained in:
Leonard Kim 2017-12-04 14:18:25 -08:00 committed by yanas
parent 6b8b929d92
commit aa93a78372
2 changed files with 50 additions and 0 deletions

View File

@ -2,6 +2,18 @@
* Override other styles to support vertical filmstrip mode. * Override other styles to support vertical filmstrip mode.
*/ */
.vertical-filmstrip { .vertical-filmstrip {
/*
* Firefox sets flex items to min-height: auto and min-width: auto,
* preventing flex children from shrinking like they do on other browsers.
* Setting min-height and min-width 0 is a workaround for the issue so
* Firefox behaves like other browsers.
* https://bugzilla.mozilla.org/show_bug.cgi?id=1043520
*/
@mixin minHWAutoFix() {
min-height: 0;
min-width: 0;
}
.filmstrip { .filmstrip {
align-items: flex-end; align-items: flex-end;
box-sizing: border-box; box-sizing: border-box;
@ -78,6 +90,8 @@
} }
#filmstripRemoteVideos { #filmstripRemoteVideos {
@include minHWAutoFix();
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
@ -115,6 +129,8 @@
} }
#remoteVideos { #remoteVideos {
@include minHWAutoFix();
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
} }
@ -224,3 +240,33 @@
} }
} }
} }
/**
* Workarounds for Edge, IE11, and Firefox not handling scrolling properly
* with flex-direction: column-reverse. The remove videos in filmstrip should
* start scrolling from the bottom of the filmstrip, but in those browsers the
* scrolling won't happen. Per W3C spec, scrolling should happen from the
* bottom. As such, use css hacks to get around the css issue, with the intent
* being to remove the hacks as the spec is supported.
*/
@mixin undoColumnReverseVideos() {
#remoteVideos #filmstripRemoteVideos #filmstripRemoteVideosContainer {
flex-direction:column;
}
}
/** Firefox detection hack **/
@-moz-document url-prefix() {
@include undoColumnReverseVideos();
}
/** IE11 detection hack **/
@media screen and (-ms-high-contrast: active),
screen and (-ms-high-contrast: none) {
@include undoColumnReverseVideos();
}
/** Edge detection hack **/
@supports (-ms-ime-align:auto) {
@include undoColumnReverseVideos();
}

View File

@ -428,6 +428,8 @@ const Filmstrip = {
promises.push(new Promise(resolve => { promises.push(new Promise(resolve => {
thumbs.localThumb.animate({ thumbs.localThumb.animate({
height: local.thumbHeight, height: local.thumbHeight,
'min-height': local.thumbHeight,
'min-width': local.thumbWidth,
width: local.thumbWidth width: local.thumbWidth
}, this._getAnimateOptions(animate, resolve)); }, this._getAnimateOptions(animate, resolve));
})); }));
@ -437,6 +439,8 @@ const Filmstrip = {
promises.push(new Promise(resolve => { promises.push(new Promise(resolve => {
thumbs.remoteThumbs.animate({ thumbs.remoteThumbs.animate({
height: remote.thumbHeight, height: remote.thumbHeight,
'min-height': remote.thumbHeight,
'min-width': remote.thumbWidth,
width: remote.thumbWidth width: remote.thumbWidth
}, this._getAnimateOptions(animate, resolve)); }, this._getAnimateOptions(animate, resolve));
})); }));