Skip to content

Commit

Permalink
[data grid] Remove dead logic to support Safari < 13 (mui#13249)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored and DungTiger committed Jul 23, 2024
1 parent f1da7ee commit 1b6623f
Showing 1 changed file with 1 addition and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,6 @@ type AutosizeOptionsRequired = Required<GridAutosizeOptions>;

type ResizeDirection = keyof typeof GridColumnHeaderSeparatorSides;

// TODO: remove support for Safari < 13.
// https://caniuse.com/#search=touch-action
//
// 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 = false;
function doesSupportTouchActionNone(): boolean {
if (cachedSupportsTouchActionNone === undefined) {
if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
} else {
cachedSupportsTouchActionNone = true;
}
}
return cachedSupportsTouchActionNone;
}

function trackFinger(event: any, currentTouchId: number | undefined): CursorCoordinates | boolean {
if (currentTouchId !== undefined && event.changedTouches) {
for (let i = 0; i < event.changedTouches.length; i += 1) {
Expand Down Expand Up @@ -593,10 +571,6 @@ export const useGridColumnResize = (
if (!cellSeparator) {
return;
}
// If touch-action: none; is not supported we need to prevent the scroll manually.
if (!doesSupportTouchActionNone()) {
event.preventDefault();
}

const touch = event.changedTouches[0];
if (touch != null) {
Expand Down Expand Up @@ -812,7 +786,7 @@ export const useGridColumnResize = (
() => apiRef.current.columnHeadersContainerRef?.current,
'touchstart',
handleTouchStart,
{ passive: doesSupportTouchActionNone() },
{ passive: true },
);

useGridApiMethod(
Expand Down

0 comments on commit 1b6623f

Please sign in to comment.