angular / angular/components

bug(MatDialogRef): updatePosition is not consistent for previously dragged dialog

Offen
#19,539 5 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/drag-drop area: material/dialog P4
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### Reproduction

The `updatePosition()` doesn't seem to be consistent if the dialog is previously dragged.

It is my understanding, according to the documentation that `updatePosition({bottom: '5px', right: '0px'})` will place my dialog at the bottom right of its container (`cdk-overlay-container` if I'm right ?).

[Here is a forked StackBlitz from the documentation](https://stackblitz.com/edit/angular-hc5lgp?file=app%2Fdialog-overview-example.ts) with, of course, minor changes.

With it, please:
1. open the dialog
2. click on the "minimize" button next to the title (dialog goes to the bottom right of the screen as expected : 👍 nice).
3. click on the "maximize" button next to the title to get the dialog back to it initial place. Also 👍 nice.

so far so good !

4. drag the dialog downwards (or in any direction you want) generously and minimize it again.


#### Expected Behavior

The dialog should be at the exact same place as it was after step 2.

#### Actual Behavior

The dialog's position has been updated, but with an additionnal translation.
(That additionnal translation seems to be of the same length as the previous drag.)

Worst : you can get the dialog outside of the screen if your drag was too generous, preventing you from dragging it back on visual.

#### Environment

- Angular: 9.1.7 (but discovered and reproduced in 7.3.4)
- CDK/Material: 9.2.4 (but discovered and reproduced in 6.4.1)
- Chrome 83.0.4103.61 64bits
- Windows 10 64bits

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, das Verhalten im verknüpften StackBlitz zu reproduzieren, und konzentriere dich auf MatDialogRef.updatePosition() nachdem der Dialog verschoben wurde. Verfolge, wie das Verschieben und die Position unten rechts interagieren, und überprüfe anschließend, dass das Minimieren nach dem Verschieben den Dialog an derselben Position wie vor dem Verschieben platziert.

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
45/100

Neue Issues direkt in Ihr Postfach

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