Closed (fixed)
Project:
Experience Builder
Component:
Page builder
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Aug 2024 at 11:26 UTC
Updated:
7 Oct 2024 at 14:34 UTC
Jump to comment: Most recent
The zoom commands (CMD/CTRL and + CMD/CTRL and -) are currently zooming the whole interface due to default browser behavior.
There seems to a bug that means that pinch-zooming on a trackpad on Mac can also sometimes zoom the whole browser, this should also be addressed here. Moved to #3475749: Pinch gesture zooming sometimes invokes OS zoom behavior
Given that the we expect users to be zooming in and out within the preview, these commands should be redirected for this. This is common behavior for Figma and other page builders. See #19
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jessebaker commentedComment #3
fazilitehreem commentedComment #5
fazilitehreem commentedComment #6
lauriiiTested manually and seems to work as expected! 🤩
@fazilitehreem Is this something we could add automated Cypress tests for?
Comment #7
fazilitehreem commentedNot sure @laurii, we can add some test to check
Comment #8
lauriii@fazilitehreem Is this something you'd like to do?
Moving to needs work to indicate that we have some progress here 😊
Comment #10
soaratul commentedComment #11
soaratul commentedComment #12
soaratul commentedChanging status to Needs work to write test case for zoom reset and to fix a bug that I found while writing test case.
Comment #13
soaratul commentedComment #14
wim leersTests are present 👍
Bumping to since @lauriii added this to #3454094: Milestone 0.1.0: Experience Builder Demo.
Comment #15
jessebaker commentedI'm afraid I have quite a bit of feedback!
This seems to be fixed but the new test introduced in this MR is not actually testing that. TBC if it's even possible to test that the default browser behaviour is being prevented in a Cypress test!
This is not addressed yet. (mouse moving between iframe and parent during the zoom action causes it) - lets raise another issue for this specifically.
The MR is adding the ability to press the 0 key to reset the zoom but
If you zoom to an irregular zoom amount (like 83% instead of one of the zoom amounts listed in the dropdown) using pinch zoom (or ctrl + mouse wheel) and then press +, the zoom snaps to 25%. I don't know if this was introduced in this MR.
Comment #16
omkar-pd commented@jessebaker,
For this, we already have an issue that needs to be reviewed.
Zoom Behaviour Issue: Clicking Plus Button Resets Zoom Level Before Gradually Increasing
Comment #17
soaratul commented@jessebaker!
I know for this ☝️ we are about to create an separate issue still I tried to fix this using
touch-action: none;and other JS/React ways but no luck.Apart from this ☝️ I tried to write a test case 👇 in cypress to validate default browser behaviour on zoom in/out but again found nothing related to this in cypress.
For this 👇 I cannot check as my external keyboard having numeric pad is not working with my Mac by the way are the other keys plus/minus(+/-) for zoom in/out using numeric pad are passing the test?
Comment #18
jessebaker commentedComment #19
jessebaker commentedThis is a challenging issue due a number of overlapping factors. Attempting to write a clearer breakdown here to reduce some of the cognitive load!
There are further complications here when discussing different OS/browser/user input device considerations so for now I'm going to focus on a Mac Laptop with Chrome and a Mac touchpad.
Outside of Experience builder, just talking about regular web pages/browser interactions zoom is handled in two different ways:
Browser Zoom (
Cmd +andCmd -)When you use the keyboard shortcuts
Cmd +andCmd -, you are invoking Chrome's built-in browser zoom functionality. This changes the zoom level of the entire webpage, including text, images, and other content. It's a discrete step-by-step zoom and is visually indicated by a magnifying glass icon appearing in the top right of the address bar. This type of zoom is remembered by the browser for each website, meaning if you revisit the site, it will retain the zoom level you set previously.macOS Zoom (Trackpad Pinch Gesture)
When you use the pinch gesture on the trackpad, you are using macOS's native pinch-to-zoom capability. This zoom method generally provides a smoother and more fluid zooming experience. Instead of changing the zoom level in discrete steps, it allows for continuous and gradual zooming. This method is handled by the operating system and provides a different user experience compared to the browser's internal zoom function.
XB Canvas zoom (
=,+and-)Pressing
+/=or-while in XB will zoom the canvas. This is handled in two different places because we have to handle the keyboard shortcuts different depending on if the user has focused inside the preview iFrame or the parent document.1st Issue
Pressing
cmd +is simultaneously invoking the Browser Zoom and the XB Canvas Zoom. This occurs because there is no check for theevent.metaKeyboolean when we handle the keydown event. This bug appears to only affect our handling the event when the user's focus is inside the preview iFrame inuseIframeKeyHandlers.ts. I guess theuseHotkeyshook that we use inCanvas.tsxwhen the event occurs outside the iFrame is correctly stopping this behaviour.1st Issue solution
There are two options here.
cmd +will invoke Browser Zoom but not XB Canvas Zoom. + will invoke XB Canvas Zoom but not Browser Zoom. This is possibly required for a11y to allow a user to zoom the XB UI. Implemented in MR !320The first can be done by: When handling the keypress events in
useIframeKeyHandlers.tscheck for the value of theevent.metaKeyand don't invoke the XB Canvas Zoom if it is true.The second can be done by: Adding an event listener (both inside and outside the iFrame) that does something like
At this point - a decision needs to be made on which solution is best (taking into account A11y and user expectations based on competing products.)
2nd Issue
Given the complexity of issue 1, I'm going to move the other issue to it's own ticket. #3475749: Pinch gesture zooming sometimes invokes OS zoom behavior
Comment #20
jessebaker commentedComment #22
jessebaker commentedI have made MR !320 which will stop both events happening simultaneously as that is actually a bug.
I propose that we code review and merge that if we are happy that it addresses that bug. Once that is merged we need to take a look at @soaratul's MR and see what changes in there we would like to carry on (for instance the keyboard shortcut to reset the zoom level).
I have raised a follow up issue to explore the UX and a11y implications of @lauriii's originally proposed solution (preventing users from using Browser Zoom with keyboard shortcuts) #3475838: Consider a11y impact and/or competitor analysis for preventing browser zoom
Comment #25
balintbrewsGiven the complexities, I think we landed this issue at a very good place, with great analysis on where to go from here, and a clean solution for an incremental improvement. We have two follow-up issues:
Comment #26
wim leers👍