Skip to content

Commit

Permalink
fix(editor): Prevent browser zoom when scrolling inside sticky edit m…
Browse files Browse the repository at this point in the history
…ode (#8116)

## Summary
Fixes a bug where zooming inside a sticky edit mode would trigger
browser zoom. Instead, triggers regular canvas zoom.


## Related tickets and issues
Fixes ADO-1581


## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.
  • Loading branch information
MiloradFilipovic authored and ivov committed Dec 27, 2023
1 parent 43eca24 commit e5135b1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/design-system/src/components/N8nSticky/Sticky.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
@mouseup.stop
@keydown.esc="onInputBlur"
@keydown.stop
@wheel.stop
:class="{ 'full-height': !shouldShowFooter, 'sticky-textarea': true }"
>
<n8n-input
Expand All @@ -45,6 +44,7 @@
:rows="5"
@blur="onInputBlur"
@update:modelValue="onUpdateModelValue"
@wheel="onInputScroll"
ref="input"
/>
</div>
Expand Down Expand Up @@ -180,6 +180,12 @@ export default defineComponent({
this.isResizing = true;
this.$emit('resizestart');
},
onInputScroll(event: WheelEvent) {
// Pass through zoom events but hold regular scrolling
if (!event.ctrlKey && !event.metaKey) {
event.stopPropagation();
}
},
},
watch: {
editMode(newMode, prevMode) {
Expand Down

0 comments on commit e5135b1

Please sign in to comment.