Repository navigation
fix(html5): prevent pinch-to-zoom for viewers and WB users on touch devices - #24947
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdded three coordinated protections to prevent pinch-zoom for non-presenter users: an HTML-level Sequence DiagramsequenceDiagram
participant User as User/Touch Device
participant Document as HTML Document
participant Hooks as useMouseEvents Hooks
participant Component as Whiteboard Component
participant Editor as tlEditorRef (Editor)
User->>Document: gesturestart / gesturechange (pinch)
Document->>Document: gesturestart -> preventDefault()
Document->>Document: gesturechange -> preventDefault()
User->>Hooks: pointerdown (non-primary)
Hooks->>Hooks: isPresenter?
alt Not Presenter & non-primary
Hooks->>Hooks: stopPropagation()
Hooks->>Editor: cancel current action
else Presenter or primary pointer
Hooks->>Editor: allow action
end
User->>Component: touchstart (2+ fingers)
Component->>Component: isPresenter?
alt Non-Presenter & multi-touch
Component->>Component: preventDefault() + stopPropagation()
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx (1)
2346-2355: Overlay is purely decorative — mark it as such for assistive tech and consider pointer-events.The overlay is rendered only to capture/swallow touch gestures for non-presenter, non-WB-access users. Minor hardening suggestions:
- Add
aria-hidden="true"so screen readers don't announce an empty region.touchAction: 'none'only affects touch gestures; if the intent is to fully block interaction (including mouse), considerpointerEvents: 'auto'explicitly, or converselypointerEvents: 'none'if you want the overlay to be purely atouch-actionhint without capturing clicks. Today, with defaultpointerEvents: autoandzIndex: 300, the overlay will swallow mouse clicks aimed at the tldraw canvas for viewers without WB access — verify that's intentional (viewers can't click anything in tldraw anyway, but this also covers any tldraw-rendered overlays like cursors).Proposed tweak
{!isPresenter && !hasWBAccess && ( <div + aria-hidden="true" style={{ position: 'absolute', inset: 0, zIndex: 300, touchAction: 'none', }} /> )}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx` around lines 2346 - 2355, The overlay rendered in the conditional (!isPresenter && !hasWBAccess) should be marked decorative and have explicit pointer handling: add aria-hidden="true" to the div and set pointerEvents: 'auto' in the inline style object (or pointerEvents: 'none' if you instead want it to be purely non-interactive while still preserving touchAction behavior); update the JSX for the overlay div (the element rendered when !isPresenter && !hasWBAccess) to include these attributes so assistive tech ignores it and pointer behavior is explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bigbluebutton-html5/imports/ui/components/whiteboard/hooks.js`:
- Around line 263-268: The handler handlePointerDown should only call
tlEditorRef.current.cancel() for non-primary touch pointers so stylus/pen
strokes aren't aborted; update the conditional to include event.pointerType ===
'touch' (e.g., if (!event.isPrimary && event.pointerType === 'touch' &&
!isPresenterRef.current) { event.stopPropagation();
tlEditorRef.current?.cancel(); }) while keeping the stopPropagation and
references to handlePointerDown, isPresenterRef, and tlEditorRef unchanged.
---
Nitpick comments:
In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx`:
- Around line 2346-2355: The overlay rendered in the conditional (!isPresenter
&& !hasWBAccess) should be marked decorative and have explicit pointer handling:
add aria-hidden="true" to the div and set pointerEvents: 'auto' in the inline
style object (or pointerEvents: 'none' if you instead want it to be purely
non-interactive while still preserving touchAction behavior); update the JSX for
the overlay div (the element rendered when !isPresenter && !hasWBAccess) to
include these attributes so assistive tech ignores it and pointer behavior is
explicit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 99114256-24b8-404f-999a-4127347e01f6
📒 Files selected for processing (3)
bigbluebutton-html5/client/main.htmlbigbluebutton-html5/imports/ui/components/whiteboard/component.jsxbigbluebutton-html5/imports/ui/components/whiteboard/hooks.js
There was a problem hiding this comment.
Pull request overview
Prevents unintended pinch-to-zoom behavior on touch devices for non-presenters in the HTML5 client’s presentation/whiteboard area, and cancels accidental whiteboard strokes triggered during multi-touch gestures.
Changes:
- Block multi-touch pinch gestures for non-presenters via touch/pointer event handling in whiteboard hooks.
- Add a transparent overlay to disable touch gestures when the user has neither presenter nor whiteboard access.
- Prevent default handling of
gesturechangeevents globally (in addition to existinggesturestart) to further reduce iOS Safari zoom behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bigbluebutton-html5/imports/ui/components/whiteboard/hooks.js | Adds pointer/touch gesture handling to suppress pinch actions for non-presenters and cancel accidental strokes. |
| bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx | Adds an overlay layer with touch-action: none for users without presenter/WB access to block touch gestures. |
| bigbluebutton-html5/client/main.html | Adds gesturechange prevention to complement existing gesturestart prevention. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✅ Automated tests have passed! |
ramonlsouza
left a comment
There was a problem hiding this comment.
tested on a real mobile device, works as expected!
A presenter's two-finger pinch moved the camera twice per frame: tldraw's own pinch (use-gesture on the canvas, absolute zoom on every pointermove) and BBB's touchmove handler (throttled to 175 ms, steps of 10 zoom points animated over 175 ms). Each tldraw write cancelled BBB's animation, which is the flicker (18-36 zoom reversals per slow pinch), and the camera ended on tldraw's value. Touch zoom was only published when that value, rounded, equalled the toolbar zoom BBB had computed from an earlier camera, so a slow pinch was never published and viewers kept the old view. tldraw also let the zoom go below 100 %. No second touch pointer reaches tldraw any more (stopped at capture, as the viewer block of #24947 already did), so its pinch never starts. BBB's handler is the only writer: a continuous zoom from the finger distance, clamped to 100-400 % (25-400 % on the infinite whiteboard) like the wheel, about the point between the fingers, which it also follows for a two-finger pan. While the gesture flag is set, every camera change is published like a wheel zoom, zoomChanger follows the camera, and the zoom effect does not re-animate the camera to the rounded percent; the flag lasts 300 ms past touchend, longer than zoomChanger's 200 ms debounce. The second finger ends what the first one started only when a tool is busy: interrupt() drops an undragged dot, complete() keeps a dragged stroke. Idle tools are left alone, because tldraw's idle states switch to the select tool on cancel, which took the pencil away from a whiteboard user on a two-finger tap. A shape removed before it was persisted is now dropped from the pending batch; otherwise the dropped dot was still sent and came back from the server. The pan clamp in onBeforeChange took the viewport of the camera before the write. At 100 % that viewport is the whole slide, so the first zoom step of a pinch, wheel or keyboard zoom was pushed back to (0, 0) and the zoom stopped being centred on the fingers. It now uses the zoom being written. The range gate of #25671 takes 100 % from initialZoomRef, the base the handler, the wheel and the toolbar percent use, so writes at the bounds pass. It only checks user writes, so a resize or page restore is not rejected while that base catches up. Fixes #26079



What does this PR do?
On phones and tablets, participants could accidentally zoom the presentation by pinching the screen, which should only be allowed for the presenter. We now block pinch gestures for all non-presenter participants, keeping the presentation locked in place on touch devices. As a bonus, any accidental drawing stroke triggered while pinching is automatically cancelled for whiteboard users.
Closes Issue(s)
Closes #24900
How to test
More
ScreenRecording_04-21-2026.13-59-17_1.MP4