Media editor modal: disable scroll wheel zoom while a crop is active#77826
Media editor modal: disable scroll wheel zoom while a crop is active#77826
Conversation
…oom sensitivity. - Updated InteractionController to use the new zoom speed constant, changing default from 0.01 to 0.0025.
…ize. Introduced isResizing state and ref to manage resizing state, ensuring wheel events are ignored while resizing. Updated tests to verify this behavior.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the media editor cropper’s default wheel-zoom sensitivity by introducing a shared DEFAULT_WHEEL_ZOOM_SPEED constant and wiring it through the core interaction controller, with accompanying doc/test updates.
Changes:
- Introduces
DEFAULT_WHEEL_ZOOM_SPEED = 0.0025as the new default wheel zoom multiplier. - Updates
InteractionControllerto use the shared default instead of an inline0.01. - Updates interaction-controller unit tests and option docs to reflect the new default.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/media-editor/src/image-editor/react/hooks/use-interaction.ts | Updates option doc comment to reflect new default wheel zoom speed. |
| packages/media-editor/src/image-editor/core/test/interaction-controller.ts | Updates wheel-zoom expectations to use DEFAULT_WHEEL_ZOOM_SPEED. |
| packages/media-editor/src/image-editor/core/interaction-controller.ts | Switches lazy zoomSpeed default from 0.01 to DEFAULT_WHEEL_ZOOM_SPEED. |
| packages/media-editor/src/image-editor/core/constants.ts | Adds DEFAULT_WHEEL_ZOOM_SPEED constant and documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
andrewserong
left a comment
There was a problem hiding this comment.
Oh, this is much nicer, thank you! I think I'd gotten stuck from this behaviour a few times but it didn't quite click for me why.
Separately, we might also disable it while panning, but not a blocker at all.
LGTM 🚀
|
Size Change: +63 B (0%) Total Size: 7.82 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in 1ee7d9e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25152966950
|
What?
Makes wheel zooming in the media editor cropper less disruptive by:
0.01to0.0025.Why?
High-resolution scroll devices, such as Apple Magic Mouse, can:
When this happens while resizing a crop area, the cropper can accidentally zoom and pan at the same time as the resize gesture, making the crop surface feel unstable.
Ignoring wheel zoom only during an active crop resize keeps handle dragging predictable while preserving normal wheel zoom behavior for the canvas.
Testing
You shouldn't be able to do this!
2026-04-30.17.17.10.mp4