[4.0] Hidden presentation reopens by itself when a screen share ends if anything was drawn on the slide

Author: antobinaryCreated Sep 26, 2026Updated Sep 26, 2026
Labelsmodule: client

Summary

With the default presentation.restoreOnUpdate: true, a presenter who hides the presentation, starts a screen share and stops it gets the presentation back open about one second after the stop, whenever at least one annotation was drawn (or erased) on the current slide since they joined. With no annotations the pre-share hidden state is restored correctly.

The reopen is not a user action. The client first broadcasts presentationIsOpen=false (the correct restore), then broadcasts presentationIsOpen=true roughly 0.2 s later, from the "restore presentation on new events" path in the presentation container.

Field data from a K-12 deployment (seven 4.0 servers, one week): of 1,251 screen-share stops that started with the presentation hidden, 37-39% came back open. Same presenter, same meeting, often both outcomes. That matches a timing race, see Root cause.

Environment

  • bbb-html5 2:4.0.0~rc.2+20260911T190005-git.local-build-60217bd717 (v4.0.x-develop, 11 Sept 2026), same code as HEAD for every file named below
  • Unified layout, default settings.yml (presentation.restoreOnUpdate: true, layout.hidePresentationOnJoin: false)
  • Chrome 151, LiveKit media bridge. Reproduced 4 of 4 attempts.

Steps to reproduce

  1. Create a meeting with the default presentation and join as moderator (you are presenter). Optionally join 2-4 viewers with webcams; they are not required.
  2. On the slide, select the pencil tool (button[data-testid="tools.draw"]) and draw one stroke. Optionally press Ctrl+Z once. Any annotation-history row is enough, one stroke is enough.
  3. Click "Hide presentation" (button[data-test="minimizePresentation"]). Webcams fill the area, button[data-test="restorePresentation"] appears.
  4. Click "Share screen" (button[data-test="startScreenShare"]) and share anything. Wait a few seconds.
  5. Click "Stop sharing" (button[data-test="stopScreenShare"]).

For automation with headless Chrome: launch with --use-fake-ui-for-media-stream --use-fake-device-for-media-stream --auto-select-desktop-capture-source="Entire screen".

Expected

The presentation stays hidden after the stop, as it was before the share. restorePresentation is visible, div[data-test="presentationContainer"] is absent.

Actual

About 1 s after the stop the presentation is open again: presentationContainer is present, minimizePresentation is visible, and the meeting layout was set to presentationIsOpen=true by the presenter's own client.

Control: repeat steps 3-5 in a fresh meeting without step 2. The presentation stays hidden every time (4 of 4).

Evidence

Presenter's graphql websocket, times relative to the click on "Stop sharing" (one of four identical cycles):

+0.61s  recv  meeting.componentsFlags.hasScreenshare = false   -> PresentationContainer remounts
+0.81s  recv  screenshare subscription -> []                   -> Screenshare component unmounts, pile restore runs
+0.93s  sent  subscription annotationHistoryStream  cursor=2026-09-26T11:53:38.646Z   (same cursor as at join)
+1.04s  sent  mutation meetingLayoutSetProps presentationIsOpen=false     <- correct restore
+1.13s  sent  mutation meetingLayoutSetProps presentationIsOpen=false
+1.15s  recv  pres_annotation_history_curr_stream  3 rows                 <- replay of every history row since join
+1.23s  sent  mutation meetingLayoutSetProps presentationIsOpen=true      <- reopen
+1.34s  sent  mutation meetingLayoutSetProps presentationIsOpen=true

Over the whole session the annotations query CurrentPageAnnotationsQuery was sent exactly once (at join, 0 rows, cursor = meeting creation time). Every later remount of the presentation container re-sent annotationHistoryStream with that identical cursor and received the same 3-row batch.

Root cause

bigbluebutton-html5/imports/ui/components/presentation/container.jsx

  • Lines 83-89: useQuery(CURRENT_PAGE_ANNOTATIONS_QUERY) with the default Apollo cache-first policy. It runs once; every later mount of the container is answered from the cache.
  • Lines 91-105: lastUpdatedAt is derived from that (stale) result, so the stream cursor never advances after join.
  • Lines 109-118: useSubscription(ANNOTATION_HISTORY_STREAM, { onData }) restores the presentation whenever a batch is non-empty and the presentation is closed:
javascript
if (annotationStream.length > 0 && restoreOnUpdate && !presentationIsOpen) {
  MediaService.setPresentationIsOpen(layoutContextDispatch, true);
}

It uses the raw restoreOnUpdate setting. The presenter guard shouldRestoreOnUpdate (line 268) only protects the slide-change path in component.jsx, not this one.

Why it only happens around a screen share: app/container.tsx line 111 makes shouldShowPresentation false while a share is displayed, so the presentation container unmounts at share start and remounts at share stop. The remount restarts the stream from the stale cursor and Hasura replays all history rows for the page since that cursor, i.e. every stroke, erase and undo since the user joined. If that replay lands after the pile restore has closed the presentation (layout/context.jsx lines 1899-1911, the WHITEBOARD_OPEN branch reading presentationLastState), the handler reopens it. If it lands before, the presentation is still open at that instant and nothing happens. That ordering is the race behind the ~40% field rate; in this environment the replay lost every time.

Suggested fix

Any one of these stops the reopen; the first two are the safest together:

  1. Ignore the replay on (re)subscribe: only restore for history rows newer than the moment the container mounted, or skip the first onData batch after a new subscription. The replay is history, not a "new event".
  2. Use the presenter-guarded shouldRestoreOnUpdate in the stream handler, consistent with the slide-change path.
  3. Refresh the cursor on mount (fetchPolicy: 'network-only' on CURRENT_PAGE_ANNOTATIONS_QUERY, or refetch on mount). Note this alone may still replay the newest row if the streaming cursor is inclusive; not verified.

Regression test (Playwright, bigbluebutton-tests/playwright)

As moderator: draw one pencil stroke, click minimizePresentation, start and stop a screen share, then assert for 5 s that restorePresentation stays visible and presentationContainer stays detached. The existing screenshare specs stop the share with the presentation open, so they cannot catch this.

Related

  • Hiding the presentation during a share and then stopping restores to the pre-share state (open). That is by design: actions-bar/presentation-options/component.jsx line 83 only records presentationLastState when the presentation is the only content. Worth documenting, not part of this bug.
  • #25592 (viewers only), #25190, #17668 are nearby but different.

https://github.com/user-attachments/assets/3454d9bc-b9b3-40e5-a3d2-ff815228cba7

Source: bigbluebutton/bigbluebutton