Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Wrong size when resizing diagonally with lockAspectRatio

Open
#222 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
react, typescript
Domain
frontend

Research direction

Start with the ResizableBox and Resizable behavior using lockAspectRatio, then run the linked CodeSandbox reproduction and compare diagonal resizing with version 2.0.0 versus 3.0.0 or later. The fix is done when diagonal resizing tracks the cursor without cumulative size errors, including resizing large components smaller and vice versa.

Written by the indexing model from the issue text.

Description

Thanks for opening an issue!

Please select the type of issue you're reporting. For questions.

  • Bug
  • Feature Request
  • Question
Problem Report

If lockAspectRatio option is set to true and you resize ResizableBox/Resizable diagonally, the size is wrong, the content is resized way faster than the mouse cursor moves. The issue is cumulative and is more noticeable while resizing a large ResizableBox/Resizable to a smaller one or vice versa.
It can be reproduced on version 3.0.0 and higher (see attached video resizable-3.0.4), but on version 2.0.0 and lower everything is ok (see attached video resizable-2.0.0) .

System Info

Node Version: v16.16.0
Browser: Google Chrome 113.0.5672.127
OS: Windows 10

Reproduction

https://codesandbox.io/s/long-https-uoun8f?file=/src/ResizableBox.js

https://github.com/react-grid-layout/react-resizable/assets/63339331/6868c5e7-df8e-4d2e-921a-7e6ec00ee909

https://github.com/react-grid-layout/react-resizable/assets/63339331/a57e60c1-9c27-4b6b-bc30-d210e968eb0a

Dominant language
TypeScript
Stars
2.6k
Forks
372
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-grid-layout/react-resizable

All issues in react-grid-layout/react-resizable

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.