base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[drawer] Opening a Drawer freezes rendering for seconds on iOS 27 Safari over a playing video

Open atiqrahmanx opened this issue 2 months ago • 2 comments

Bug report

Current behavior

On iOS 27 Safari, opening a Drawer (and, in our tests, a Dialog styled the same way) freezes rendering for several seconds. The page is a video meeting with a live <video> element playing.

We measured this on the device with performance.now() probes reported to our server:

  • The tap reaches the trigger quickly: pointerdown to click takes 50–86 ms.
  • React commits the open quickly: click to first DOM change takes 13–38 ms.
  • Then no animation frame is delivered for 3.8–5.2 s, growing to 12.8 s on later opens as the phone heats up. That's a single frame gap from our requestAnimationFrame loop.
  • While the drawer is open, taps sit in Safari's queue for 1.5–4.6 s before pointerdown reaches the page. Some taps never become clicks.
  • Every button inside the drawer that opens another drawer pays the same cost.

What we ruled out, one switch at a time on the device. The drawer still froze about 4 s with each of these:

Variant Still froze?
No Drawer.Backdrop yes
No backdrop-filter anywhere on the page yes
transition-property: none on Backdrop, Viewport and Popup yes
modal={false} (no aria-hidden on siblings, no internal backdrop) yes
No snapPoints / defaultSnapPoint yes
Without Drawer.VirtualKeyboardProvider yes
initialFocus={false} and finalFocus={false} yes
Drawer.Portal container set to an element inside the app root, not <body> yes
Dialog (Root/Portal/Backdrop/Viewport/Popup) instead of Drawer, same styles yes
An empty Drawer.Popup (only Title and Close inside) yes, 4.4 s
The same menu in a plain position: fixed panel, no Base UI no, opens in 74–78 ms with smooth frames
Our replacement (below), no Base UI no, reported "crazy fast"

Expected behavior

The drawer opens in roughly the same time as a plain fixed panel. Nothing should block rendering for seconds.

Reproducible example

Sorry, we don't have a standalone sandbox. It only reproduces on a real iOS 27 device in a page with a live camera <video>. Chromium with iOS emulation opens the same drawer in 40–70 ms. Desktop WebKit (Playwright, Linux) showed no multi-second freeze, though its frame timing was too noisy to give a number. With a fake camera feed in Chromium, opening and closing 8 times showed no leak and no lingering work.

Our drawer, roughly. This is the shape of the Base UI drawer examples, StyleX-compiled:

<Drawer.Root open={open} onOpenChange={…} snapPoints={[1]} defaultSnapPoint={1} swipeDirection="down" modal>
  <Drawer.VirtualKeyboardProvider>
    <Drawer.Portal>
      <Drawer.Backdrop /* fixed, inset 0, opacity transition */ />
      <Drawer.Viewport /* position: fixed; inset: 0; display: flex; align-items: flex-end; touch-action: none */>
        <Drawer.Popup /* height: 80dvh; touch-action: none; translate + transform transitions */>
          <Drawer.Title /> <Drawer.Close />
          <Drawer.Content /* touch-action: auto; overflow hidden */>{children}</Drawer.Content>
        </Drawer.Popup>
      </Drawer.Viewport>
    </Drawer.Portal>
  </Drawer.VirtualKeyboardProvider>
</Drawer.Root>

Base UI version

v1.8.0. We also read the source at main (19511bb, 2026-10-02) and found no change that looks related.

Which browser are you using?

Safari iOS 27 (Version/27.0 Mobile/15E148 Safari/604.1).

Which OS are you using?

iOS 27 (iPhone).

Which assistive tech are you using (if applicable)?

None.

Additional context

Every Base UI variant we tried had two things that the fast plain panel didn't:

  1. A viewport-sized position: fixed element (the Viewport) layered over the playing video.
  2. touch-action: none on that Viewport and on the Popup, as the drawer examples recommend for swipe.

Our replacement has neither. It has no full-viewport element, uses default touch-action, and handles outside dismissal with a document pointerdown listener instead of a backdrop. It fixed the freeze completely. We have not proven which of the two is the trigger, and this may be a WebKit/iOS 27 regression rather than a Base UI bug. We're filing it because the recommended Drawer markup is what hit it, and because others shipping Base UI drawers over video on iOS 27 may run into the same thing.

If it would help, we're happy to run a specific variant on the device. For example, the same Drawer with touch-action left at auto, or a Viewport that isn't full-screen.

atiqrahmanx avatar Oct 04 '26 09:10 atiqrahmanx

I can't reproduce it locally. An automated debug harness was written by Claude, who tested various setups on iOS 27.0.0 on iPhone 12. Its analysis (and what I saw) showed no freeze:

A test page plays a live <video> behind the overlay, fed either by the front camera (getUserMedia) or by canvas.captureStream(). It opens and closes 13 variants. After each open it logs the longest requestAnimationFrame gap over 6 s and the delay from tap to pointerdown, and sends both to a server on the LAN. Each variant ran automatically and was also opened by hand with real taps. The variants included:

  • a plain position: fixed panel, as the control
  • a full-viewport fixed layer with touch-action: none and no Base UI, also with a backdrop and with a slide-in transition
  • Dialog with modal={false}: no Viewport, a full-viewport Viewport with touch-action: auto, and one with touch-action: none
  • your Drawer markup: snapPoints={[1]}, VirtualKeyboardProvider, a backdrop, and touch-action: none on the Viewport and Popup

In every run, each variant painted its first frame within 40 ms, and no frame gap went over 60 ms. Every tap reached pointerdown in under 30 ms. A full-viewport touch-action: none layer over a playing video doesn't trigger the freeze by itself, with or without Base UI.

You could try building the harness here using:

LLM prompt
In our app on the affected iPhone, with live video playing, find which single change
stops the Drawer-open freeze from mui/base-ui#5878. For 6 s after each open, log the
longest requestAnimationFrame gap and the tap delay (performance.now() - event.timeStamp)
to our server.

Variants, each changing one thing from A:
A  current Drawer (baseline)
B  touch-action: auto on Viewport and Popup
C  Viewport not full-screen (inset: auto 0 0 0)
D  no Base UI: plain fixed inset-0 div with touch-action: none and the same content
E  videos hidden (visibility: hidden) while open

Use real taps and run the variants interleaved, 3 rounds from a cool phone. Report
iOS version, iPhone model, and a table of the worst gap per variant. If D freezes,
strip the page down to a minimal standalone HTML file that still freezes.

atomiks avatar Oct 05 '26 05:10 atomiks

Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

github-actions[bot] avatar Oct 12 '26 09:10 github-actions[bot]