angular / angular/components

bug(drag-drop): changing the disable state dynamically doesn't work

Offen
#19,065 10 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/drag-drop P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### Reproduction

For some reason, in Stackblitz it works: https://stackblitz.com/edit/angular-ghqzcr
But in a new project, the bug also reproduces: https://github.com/doronsever/drag-drop-bug
I copied everything from stackblitz to my project and still doesn't work.

I need the initiate state of the drag and drop to be disabled and only when clicking on the mouse down to enable it.
The reason for that is that I have also a resize option and if the drag and drop is enabled, when resizing it is also dragging the element.

So in my real app, I'm starting with the drag and drop disabled, and on a mousedown event, I check if the mouse is not touching the resize button and only then enabling the drag and drop.
Up until Angular 8, everything worked fine but now that we are trying to upgrade to Angular 9 (and also material to 9, this behavior stopped working).


#### Expected Behavior

When setting the flag to false, enable the dragging even if the mouse is down.

#### Actual Behavior

drag and drop doesn't work

#### Environment

- Angular: 9.1.1
- CDK/Material: 9.2.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Mac

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die StackBlitz-Reproduktion mit der verlinkten new-project-Reproduktion zu vergleichen, wobei du dich auf das Angular-CDK-Drag-and-Drop-Setup und das dynamische disabled-Flag konzentrierst. Reproduziere das Verhalten von Angular 9.1.1/Material 9.2.0 in Chrome und überprüfe anschließend, dass das Ziehen während mousedown aktiviert werden kann, während durch das Ändern der Größe kein Ziehen gestartet wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.