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

fix(cdk/drag-drop): constrainPosition not working as expected #25061

Merged
merged 1 commit into from
Jun 12, 2022

Conversation

crisbeto
Copy link
Member

Fixes that the constrainPosition input wasn't constraining the position as described in the docs. This may have worked at some point, but it's definitely broken now. Our tests didn't catch it, because they were looking at the transform which was wrong, instead of the position the element ended up at.

I've also added the current element dimensions to the callback since they could be useful.

Fixes #25046.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release labels Jun 11, 2022
@crisbeto crisbeto requested a review from devversion June 11, 2022 07:14
Fixes that the `constrainPosition` input wasn't constraining the position as described in the docs. This may have worked at some point, but it's definitely broken now. Our tests didn't catch it, because they were looking at the `transform` which was wrong, instead of the position the element ended up at.

Fixes angular#25046.
@crisbeto crisbeto force-pushed the 25046/drag-drop-constrain-position branch from 6914fe3 to 73dd58b Compare June 11, 2022 10:28
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jun 11, 2022
@crisbeto crisbeto self-assigned this Jun 11, 2022
@crisbeto crisbeto merged commit 2c956c0 into angular:main Jun 12, 2022
crisbeto added a commit that referenced this pull request Jun 12, 2022
Fixes that the `constrainPosition` input wasn't constraining the position as described in the docs. This may have worked at some point, but it's definitely broken now. Our tests didn't catch it, because they were looking at the `transform` which was wrong, instead of the position the element ended up at.

Fixes #25046.

(cherry picked from commit 2c956c0)
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Jun 22, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@angular/cdk](https://github.com/angular/components) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fcdk/14.0.1/14.0.2) |
| [@angular/material](https://github.com/angular/components) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fmaterial/14.0.1/14.0.2) |

---

### Release Notes

<details>
<summary>angular/components</summary>

### [`v14.0.2`](https://github.com/angular/components/blob/HEAD/CHANGELOG.md#&#8203;1402-corduroy-collar-2022-06-16)

[Compare Source](angular/components@14.0.1...14.0.2)

##### cdk

| Commit | Type | Description |
| -- | -- | -- |
| [08c3867ba6](angular/components@08c3867) | fix | **a11y:** re-apply the high contrast mode class when the forced-colors media query changes ([#&#8203;25088](angular/components#25088)) |
| [59268fa5bf](angular/components@59268fa) | fix | **drag-drop:** constrainPosition not working as expected ([#&#8203;25061](angular/components#25061)) |
| [732969079d](angular/components@7329690) | fix | **testing:** simulate offsetX and offsetY in mouse events |

##### material-experimental

| Commit | Type | Description |
| -- | -- | -- |
| [5aec60c9ca](angular/components@5aec60c) | fix | **mdc-button:** don't apply styles to icons within the text label ([#&#8203;24929](angular/components#24929)) |
| [d0082e3422](angular/components@d0082e3) | fix | **mdc-chips:** checkmark blending into background in high contrast mode ([#&#8203;25072](angular/components#25072)) |
| [2388fe77e5](angular/components@2388fe7) | fix | **mdc-core:** consolidate mdc theming code under mdc-core ([#&#8203;25084](angular/components#25084)) |
| [7de5f5432b](angular/components@7de5f54) | fix | **mdc-form-field:** replace !important with CSS var ([#&#8203;24964](angular/components#24964)) |
| [8f7394aa3b](angular/components@8f7394a) | fix | **mdc-list:** don't access class before initialization ([#&#8203;25049](angular/components#25049)) |

#### Special Thanks

Jenny Johnson, Kristiyan Kostadinov, Miles Malerba, Paul Gschwendtner and antuxity

<!-- CHANGELOG SPLIT MARKER -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1425
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@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 Jul 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

help(COMPONENT): cdkDragConstrainPosition works strange
2 participants