Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CdkDrag: cdkDragHandleDisabled does not work if it is set on component instantiation #16642

Closed
skrtheboss opened this issue Jul 30, 2019 · 2 comments · Fixed by #16643 or hrueger/AGLight#112
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@skrtheboss
Copy link
Contributor

Reproduction

Go to StackBlitz - Handle Disabled Example.
The initial state for cdkDragHandleDisabled is disabled but dragging works, only after clicking on enable and after on disable the handle is actually disabled.

Expected Behavior

The handle should be disabled at the beginning.

Actual Behavior

The handle is not disabled at the beginning.

Environment

  • Angular: 8.1.3
  • CDK/Material: 8.1.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@skrtheboss
Copy link
Contributor Author

Possible solution is to add a startWith on state changes observable on this line:

return merge(...handles.map(item => item._stateChanges));

return merge(...handles.map(item => item._stateChanges.pipe(startWith(item))));

@crisbeto crisbeto self-assigned this Jul 30, 2019
@crisbeto crisbeto added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Jul 30, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 30, 2019
Fixes the `CdkDrag` directive not picking up the `disabled` state of a handle, if it was set before `CdkDrag` subscribed to its `_stateChanges` stream.

Fixes angular#16642.
jelbourn pushed a commit that referenced this issue Sep 6, 2019
Fixes the `CdkDrag` directive not picking up the `disabled` state of a handle, if it was set before `CdkDrag` subscribed to its `_stateChanges` stream.

Fixes #16642.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 2, 2019
Fixes the `CdkDrag` directive not picking up the `disabled` state of a handle, if it was set before `CdkDrag` subscribed to its `_stateChanges` stream.

Fixes angular#16642.
jelbourn pushed a commit that referenced this issue Jan 27, 2020
Fixes the `CdkDrag` directive not picking up the `disabled` state of a handle, if it was set before `CdkDrag` subscribed to its `_stateChanges` stream.

Fixes #16642.
jelbourn pushed a commit that referenced this issue Jan 27, 2020
Fixes the `CdkDrag` directive not picking up the `disabled` state of a handle, if it was set before `CdkDrag` subscribed to its `_stateChanges` stream.

Fixes #16642.

(cherry picked from commit 0760454)
yifange pushed a commit to yifange/components that referenced this issue Jan 30, 2020
…lar#16643)

Fixes the `CdkDrag` directive not picking up the `disabled` state of a handle, if it was set before `CdkDrag` subscribed to its `_stateChanges` stream.

Fixes angular#16642.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
2 participants