Skip to content

Commit

Permalink
[core] Utilize CSS.supports in SliderUnstyled component (#27724)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanailH committed Aug 16, 2021
1 parent 2a025b2 commit 3701822
Showing 1 changed file with 9 additions and 5 deletions.
Expand Up @@ -140,14 +140,18 @@ const Identity = (x) => x;
// Safari, on iOS, supports touch action since v13.
// Over 80% of the iOS phones are compatible
// in August 2020.
// Utilizing the CSS.supports method to check if touch-action is supported.
// Since CSS.supports is supported on all but Edge@12 and IE and touch-action
// is supported on both Edge@12 and IE if CSS.supports is not available that means that
// touch-action will be supported
let cachedSupportsTouchActionNone;
function doesSupportTouchActionNone() {
if (cachedSupportsTouchActionNone === undefined) {
const element = document.createElement('div');
element.style.touchAction = 'none';
document.body.appendChild(element);
cachedSupportsTouchActionNone = window.getComputedStyle(element).touchAction === 'none';
element.parentElement.removeChild(element);
if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
} else {
cachedSupportsTouchActionNone = true;
}
}
return cachedSupportsTouchActionNone;
}
Expand Down

0 comments on commit 3701822

Please sign in to comment.