Skip to content

bug: reorder event gives incorrect 'to' value when an item is dragged far enough #23796

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

Closed
4 of 6 tasks
tobysmith568 opened this issue Aug 22, 2021 · 3 comments · Fixed by #23797
Closed
4 of 6 tasks
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@tobysmith568
Copy link
Contributor

tobysmith568 commented Aug 22, 2021

Prequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

The to field on the ItemReorderEventDetail event is off-by-one (too high) when an item is dragged past the end the list.

Expected Behavior

The to field should never be more that the number of items - 1.

Steps to Reproduce

I have created a repro but this can also be reproduced in the ionic unit tests found at src/components/reorder-group/test/basic.

  • Run the app
    • If using the ionic unit tests: toggle on the reorder behaviour
  • Open the browser console
  • Drag an item to the end of the list, ensuring that is is dragged only just far enough to be in the last position
    • The console shows that it was dragged to index 11
  • Drag an item to the end of the list, ensuring that it is dragged as far as it possibly can be
    • The console shows that it was dragged to index 12

yi9j7qwFvH

Code Reproduction URL

https://github.com/tobysmith568/ionic-reorder-repro

Ionic Info

Ionic:

Ionic CLI : 6.16.3 (C:\Users\tobys\AppData\Roaming\nvm\v14.15.0\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.6.14
@angular-devkit/build-angular : 12.1.4
@angular-devkit/schematics : 12.1.4
@angular/cli : 12.1.4
@ionic/angular-toolkit : 4.0.0

Utility:

cordova-res : 0.15.3
native-run : not installed globally

System:

NodeJS : v14.15.0 (C:\Tools\nodejs\node.exe)
npm : 6.14.8
OS : Windows 10

Additional Information

Will be providing a PR with a possible solution soon.
PR: #23797

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23797, and a fix will be available in an upcoming release of Ionic Framework. Thanks for putting up the PR!

liamdebeasi pushed a commit that referenced this issue Aug 23, 2021
@tobysmith568
Copy link
Contributor Author

Hey, thanks 🎉

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 22, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants