fix(reorder-group): dragging reorder item to bottom no longer gives out of bounds index #23797
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously the 'to' detail on item reorder events could be one too high if the item was dragged far enough
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: resolves #23796
The
to
field on theItemReorderEventDetail
event is off-by-one (too high) when an item is dragged past the end the list.What is the new behavior?
to
field will never be more that the number of items - 1.Does this introduce a breaking change?
Other information
I haven't modified any tests because I could only find e2e tests, not unit tests. This fix isn't for something which is visible on the screen and therefore cannot be protected against in a e2e test.
I haven't run the linter because it doesn't appear to run at all on my machine - I assume it to be an environment issue for myself but I am confident that this PR sticks to your style guide and should pass the linting.