Skip to content

Commit 08ccf3c

Browse files
kseamonAndrew Seguin
authored and
Andrew Seguin
committed
fix(cdk-experimental/column-resize): Obscure weird behavior in tables that are too wide by conditionally disabling resize (#31100)
(cherry picked from commit 49f9966)
1 parent a0a0dfd commit 08ccf3c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/cdk-experimental/column-resize/resizable.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import {ResizeStrategy} from './resize-strategy';
4646
import {_CoalescedStyleScheduler} from './coalesced-style-scheduler';
4747

4848
const OVERLAY_ACTIVE_CLASS = 'cdk-resizable-overlay-thumb-active';
49+
const RESIZE_DISABLED_CLASS = 'cdk-resizable-resize-disabled';
4950

5051
/**
5152
* Base class for Resizable directives which are applied to column headers to make those columns
@@ -188,11 +189,18 @@ export abstract class Resizable<HandleComponent extends ResizeOverlayHandle>
188189
.pipe(takeUntilDestroyed)
189190
.subscribe(hoveringRow => {
190191
if (hoveringRow) {
191-
if (!this.overlayRef) {
192-
this.overlayRef = this._createOverlayForHandle();
193-
}
192+
const tooBigToResize =
193+
this.maxWidthPxInternal < Number.MAX_SAFE_INTEGER &&
194+
element.offsetWidth > this.maxWidthPxInternal;
195+
element.classList.toggle(RESIZE_DISABLED_CLASS, tooBigToResize);
196+
197+
if (!tooBigToResize) {
198+
if (!this.overlayRef) {
199+
this.overlayRef = this._createOverlayForHandle();
200+
}
194201

195-
this._showHandleOverlay();
202+
this._showHandleOverlay();
203+
}
196204
} else if (this.overlayRef) {
197205
// todo - can't detach during an active resize - need to work that out
198206
this.overlayRef.detach();

src/material-experimental/column-resize/_column-resize-theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
.mat-resizable-handle {
7272
background: $resizable-hover-divider;
7373
}
74+
75+
.cdk-resizable-resize-disabled > .mat-resizable-handle {
76+
background: $non-resizable-hover-divider;
77+
}
7478
}
7579

7680
[dir='rtl'] {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy