Repository navigation
feat: Enable users to pan outside the current presenters view during infinite whiteboard - #25010
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis pull request adds a new configuration option allowInfiniteWhiteboardPanForViewers that permits non-presenter users to pan the infinite whiteboard with the hand tool. The setting is added to server config, client initial values, and TypeScript types, and wired into the whiteboard component: it computes viewerCanPan, syncs a ref for handlers, conditionally exposes the hand tool in toolbars, updates initial tool selection and keyboard shortcuts (SPACE, h), and gates camera adjustments and global styling based on the flag. Sequence Diagram(s)sequenceDiagram
participant Client
participant Settings as meetingClientSettings
participant Whiteboard as WhiteboardComponent
participant Tldraw as TldrawEditor
participant Styles as TldrawV2GlobalStyle
Client->>Settings: read allowInfiniteWhiteboardPanForViewers
Settings->>Whiteboard: provide flag
Whiteboard->>Whiteboard: compute viewerCanPan, init viewerCanPanRef
Whiteboard->>Tldraw: set initial tool (hand/noop) based on viewerCanPan
Whiteboard->>Tldraw: expose hand tool in toolbar when viewerCanPan
Whiteboard->>Tldraw: handle SPACE / 'h' shortcuts using viewerCanPanRef
Whiteboard->>Whiteboard: adjustCameraOnMount(true) on slide change if viewerCanPanRef.current
Whiteboard->>Styles: pass viewerCanPan to global styles
Styles->>Client: show/hide [data-testid="tools.hand"] per viewerCanPan and role
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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx (1)
663-713:⚠️ Potential issue | 🟠 Major | ⚡ Quick winStale closure:
hshortcut should useviewerCanPanRef.current, notviewerCanPan.On Line 710 the
hhandler readsviewerCanPanfrom the closure, buthandleKeyDown’suseCallbackdependency list (Line 877-880) does not includeviewerCanPan. As a result, whenviewerCanPanflips (e.g., role/access changes, infinite whiteboard toggled), thesimpleKeyMap['h']branch will keep the stale value while the SPACE branch on Line 663 (which already usesviewerCanPanRef.current) will not. Use the ref for consistency and to avoid the stale read.🐛 Proposed fix
e: () => tlEditorRef.current?.setCurrentTool('eraser'), h: () => { - if (isPresenterRef.current || viewerCanPan) { + if (isPresenterRef.current || viewerCanPanRef.current) { tlEditorRef.current?.setCurrentTool('hand'); } },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx` around lines 663 - 713, The 'h' key handler inside simpleKeyMap uses the stale closed-over variable viewerCanPan; update that branch to read viewerCanPanRef.current (like the SPACE handling) so it always reflects the latest state — locate the simpleKeyMap 'h' entry in handleKeyDown and change the condition to if (isPresenterRef.current || viewerCanPanRef.current) while keeping uses of tlEditorRef and isPresenterRef as-is.
🧹 Nitpick comments (2)
bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx (2)
290-313: 💤 Low valueMinor: hand item position is inconsistent between modes.
In the pen-only branch (Line 294-297)
handisunshift-ed (front of toolbar), while in the multi-user branch (Line 309-312) it ispush-ed (end). This produces a visible reordering depending on which override path applies. If there is no specific UX reason, picking one position consistently (typically nearselectat the top) would be preferable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx` around lines 290 - 313, The hand/tool ordering is inconsistent: in the PEN-ONLY branch you unshift the 'hand' item, but in the MULTI-USER-TOOLS branch you push it; change the MULTI-USER-TOOLS branch to also unshift the 'hand' item so it appears at the front like in PEN-ONLY. Update the block that handles bbbMultiUserTools (the code using toolbarItems.filter and the conditional that finds the item with id === 'hand') to insert the hand with items.unshift(hand) instead of items.push(hand), and keep the existing guard that prevents adding it if already present.
476-483: 💤 Low valueConsider also reacting to
hasWBAccess/role changes.This effect only fires when
isInfiniteWhiteboardchanges, but it gates onisPresenterRef.current,isModeratorRef.current, andhasWBAccessRef.current. If a user becomes a viewer with WB access while infinite whiteboard is already on (e.g., role demotion or WB-access grant after the page rendered withisInfiniteWhiteboard=true), the tool will not be re-initialized tohand. The existing[hasWBAccess]effect at Line 433-462 readsmultiUserToolsand won’t pickhand. Consider widening the deps (or addinghasWBAccess/isModeratorhandling) so the panning viewer reliably starts inhandmode on those transitions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx` around lines 476 - 483, The effect that sets the editor tool (React.useEffect that calls tlEditorRef?.current?.setCurrentTool) only runs on isInfiniteWhiteboard changes but needs to also run when WB access or role changes; update its dependency list to include the reactive values that represent WB access and role (not only refs) — e.g., add hasWBAccess (or hasWBAccessState/prop) and the presenter/moderator role state flags (or their equivalents used elsewhere) so that when allowInfiniteWhiteboardPanForViewers && !isPresenter && !isModerator && hasWBAccess && isInfiniteWhiteboard the effect will re-run and setCurrentTool('hand') appropriately; if you must keep refs, derive/use their corresponding state/props in the deps and/or add a small listener to flip the tool when role/hasWBAccess changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx`:
- Around line 663-713: The 'h' key handler inside simpleKeyMap uses the stale
closed-over variable viewerCanPan; update that branch to read
viewerCanPanRef.current (like the SPACE handling) so it always reflects the
latest state — locate the simpleKeyMap 'h' entry in handleKeyDown and change the
condition to if (isPresenterRef.current || viewerCanPanRef.current) while
keeping uses of tlEditorRef and isPresenterRef as-is.
---
Nitpick comments:
In `@bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx`:
- Around line 290-313: The hand/tool ordering is inconsistent: in the PEN-ONLY
branch you unshift the 'hand' item, but in the MULTI-USER-TOOLS branch you push
it; change the MULTI-USER-TOOLS branch to also unshift the 'hand' item so it
appears at the front like in PEN-ONLY. Update the block that handles
bbbMultiUserTools (the code using toolbarItems.filter and the conditional that
finds the item with id === 'hand') to insert the hand with items.unshift(hand)
instead of items.push(hand), and keep the existing guard that prevents adding it
if already present.
- Around line 476-483: The effect that sets the editor tool (React.useEffect
that calls tlEditorRef?.current?.setCurrentTool) only runs on
isInfiniteWhiteboard changes but needs to also run when WB access or role
changes; update its dependency list to include the reactive values that
represent WB access and role (not only refs) — e.g., add hasWBAccess (or
hasWBAccessState/prop) and the presenter/moderator role state flags (or their
equivalents used elsewhere) so that when allowInfiniteWhiteboardPanForViewers &&
!isPresenter && !isModerator && hasWBAccess && isInfiniteWhiteboard the effect
will re-run and setCurrentTool('hand') appropriately; if you must keep refs,
derive/use their corresponding state/props in the deps and/or add a small
listener to flip the tool when role/hasWBAccess changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 738d5a08-2507-4b8d-83a6-e20a1981dbeb
📒 Files selected for processing (5)
bigbluebutton-html5/imports/ui/Types/meetingClientSettings.tsbigbluebutton-html5/imports/ui/components/whiteboard/component.jsxbigbluebutton-html5/imports/ui/components/whiteboard/styles.jsbigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.tsbigbluebutton-html5/private/config/settings.yml
|
This pull request has conflicts ☹ |
| e: () => tlEditorRef.current?.setCurrentTool('eraser'), | ||
| h: () => { | ||
| if (isPresenterRef.current) { | ||
| if (isPresenterRef.current || viewerCanPan) { |
There was a problem hiding this comment.
Or add viewerCanPan as a dependency of the useCallback or use the ref reference here
|
|
||
| React.useEffect(() => { | ||
| if (!isPresenter | ||
| && !viewerCanPan |
There was a problem hiding this comment.
I think hasWBAccess is missing here
There was a problem hiding this comment.
hasWBAccess is already implicitly covered... viewerCanPan includes it, so adding it to the condition would change behavior when allowInfiniteWhiteboardPanForViewers is not enabled
|
✅ Automated tests have passed! |
Tainan404
left a comment
There was a problem hiding this comment.
Reviewed and tested the code
4236b21
into
bigbluebutton:v3.0.x-develop



What does this PR do?
Introduces a new property to settings file:
public.whiteboard.allowInfiniteWhiteboardPanForViewers(default: false).If switched to true,
Closes Issue(s)
Closes #25008
How to test
public.whiteboard.allowInfiniteWhiteboard: truepublic.whiteboard.allowInfiniteWhiteboardPanForViewers: true