Skip to content

💄🔧:make the sidebar open on the first tap - #1856

Closed
DerekNonGeneric wants to merge 3 commits into
livefrom
fix-mobile-sidebar-trigger
Closed

DerekNonGeneric wants to merge 3 commits into
livefrom
fix-mobile-sidebar-trigger

Conversation

@DerekNonGeneric

Copy link
Copy Markdown
Member

The hamburger on mobile needed several presses before the sidebar
appeared. There are two separate faults behind that, both reproduced and
measured in headless Chromium at a phone viewport.

The toggle was bound only after Bento's runtime arrived

It came down from cdn.ampproject.org well after the page had painted,
and until it landed the button had no handler at all, so a tap was
dropped with nothing to catch it. The buttons are bound as the page
parses now and the handler waits on the API, so a tap in that gap opens
the sidebar once the runtime lands. Tapping at first contentful paint —
the first moment the button is on screen:

Bento runtime before after
+0 ms opens opens
+500 ms nothing happens opens
+1500 ms nothing happens opens
+3000 ms nothing happens opens

The 350 ms slide drags other elements across the button

Tracing what sits under the hamburger after a tap:

  17ms  div.backdrop-4250f84        closes the sidebar again
  54ms  div.navbar-toggler-wrapper  no handler, the tap vanishes
 153ms  div.navbar-toggler-wrapper  no handler, the tap vanishes
 205ms  button.navbar-toggler       finally live

So a second press while the menu was still moving either shut it or did
nothing. The sidebar stops taking taps for that beat and the toggle
ignores them:

                before                        after
every 100ms  2:open   3:CLOSED 4:CLOSED  2:open 3:open   4:open
every 200ms  2:CLOSED 3:CLOSED 4:open    2:open 3:closed 4:closed

A press past 350 ms is a deliberate second press, so it still toggles.

Also in here

  • both toggles carry aria-expanded, kept in step by watching the
    open attribute on the sidebar rather than by counting presses, so it
    stays right when the sidebar closes on the backdrop or on Escape;
    aria-controls names what they operate
  • layout='nodisplay' is gone. It is an AMP attribute and Bento has no
    layout handling, so it did nothing but imply the element starts out of
    the layout, which is the reverse of what happens

Left alone

While the sidebar is open, the host element's invisible 45px strip at
the page's left edge swallows taps on the brand logo. Worth a look, but
it is a separate fault and not what this is about.

Testing

nps test passes. To try it by hand, nps start and open the site
narrow enough for the hamburger to show: tap it once, then tap it
several times quickly.

The toggle was bound only once Bento's runtime had come down from the
CDN, so a tap made before that was dropped with nothing to catch it.
The buttons are bound as the page parses now and the handler waits on
the API, so a tap in that gap opens the sidebar once the runtime lands.

The rest is the 350ms slide. Bento draws the panel and its backdrop
across the button on the way in, so a second tap landed on whichever
was passing: the backdrop closed the sidebar again, and the panel's own
wrapper swallowed the tap entirely. The sidebar stops taking taps for
that beat and the toggle ignores them, so an impatient press leaves the
menu open rather than shutting it.

Measured in headless Chromium at a phone viewport. Tapping at first
contentful paint with the runtime 500ms out did nothing before and
opens the sidebar now; tapping three times at 100ms ended closed
before and ends open now.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
The buttons opened and closed the sidebar without saying which of the
two they would do, so only sight told you whether the menu was showing.
They carry aria-expanded now, kept in step by watching the open
attribute on the sidebar rather than by counting presses, which keeps
the answer right when the sidebar closes on the backdrop or on Escape.
aria-controls names what they operate.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
layout='nodisplay' is an AMP attribute, and Bento has no layout
handling at all. It did nothing but imply the element starts out of the
layout, which is the reverse of what happens: the host is laid out from
the start, and only its first close puts the hidden attribute on it.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
@netlify

netlify Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for gh-pages-openinf ready!

Name Link
🔨 Latest commit f78fbdd
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a8dc3ce4834840009b01350
😎 Deploy Preview https://deploy-preview-1856--gh-pages-openinf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

DerekNonGeneric added a commit that referenced this pull request Aug 25, 2026
Safari holds a tap for about a third of a second to see whether a
second one follows and it should zoom instead, and a tap inside that
wait reads as the double-tap and cancels both. Only touch-action turns
that off; iOS ignores the scale limits in the viewport, so those never
did, and asking for them took pinch-zoom from anyone who needs it on
the browsers that do listen. That is why the menu took several goes.

The button was also 34px tall, under the 44px a finger reliably hits.
Its reach grows to 44 and the button itself is left alone, so nothing
on the page moves.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
Refs: #1856
DerekNonGeneric added a commit that referenced this pull request Aug 25, 2026
Safari holds a tap for about a third of a second to see whether a
second one follows and it should zoom instead, and a tap inside that
wait reads as the double-tap and cancels both. Only touch-action turns
that off; iOS ignores the scale limits in the viewport, so those never
did, and asking for them took pinch-zoom from anyone who needs it on
the browsers that do listen. That is why the menu took several goes.

The button was also 34px tall, under the 48px recommended for a tap
target. Its reach grows to 48 and the button itself is left alone, so
nothing on the page moves.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
Refs: #1856
openinf-commit-queue Bot pushed a commit that referenced this pull request Aug 25, 2026
♿🔧:let a tap on the menu button land

Safari holds a tap for about a third of a second to see whether a
second one follows and it should zoom instead, and a tap inside that
wait reads as the double-tap and cancels both. Only touch-action turns
that off; iOS ignores the scale limits in the viewport, so those never
did, and asking for them took pinch-zoom from anyone who needs it on
the browsers that do listen. That is why the menu took several goes.

The button was also 34px tall, under the 48px recommended for a tap
target. Its reach grows to 48 and the button itself is left alone, so
nothing on the page moves.

💄🚮:build the sidebar out of markup and CSS

bento-sidebar cost three requests to a CDN we do not control, one of
them a render-blocking stylesheet, and gave back a drawer we could not
steer: an invisible full-height host that took taps meant for the
brand, a panel that slid across the button that opened it, and a second
copy of that button riding in on the panel.

A drawer is a fixed panel, a transform, and a backdrop. That is what
this is now. The header's button is the only control and never moves,
so nothing crosses it while it slides and there is no second one to
land under a finger. Nothing is fetched, so it works from the moment
the page is parsed rather than once a runtime has come down the wire.

The page no longer waits on cdn.ampproject.org to paint.

The drawer it replaces reports aria-expanded, is inert while closed so
nothing tabs into an off-screen menu, and takes focus and hands it back.
Escape and the backdrop close it, and the ring a returning focus leaves
is shown to a keyboard and not to a finger.

💄🔧:keep what the old sidebar got right

Read against bento-sidebar's own source rather than trusting that a
drawer is a drawer. Four things it did that this had dropped:

The panel hangs off the trailing edge, so in a page that reads right to
left it has to leave to the left. It was leaving to the right whatever
the direction, which parked the closed panel in the middle of the
viewport. No page sets `lang: ar` yet, but the layout emits `dir='rtl'`
for one that does.

`overflow-y: auto` alone makes the other axis scrollable too, so a long
entry would have given the drawer a horizontal scrollbar. The old one
pinned `overflow-x: hidden` on purpose.

A drag on the backdrop scrolled the page behind it. The old one made
the backdrop swallow the gesture; `touch-action` says the same thing
without the two hacks it needed to do it.

Escape closed the drawer and carried on to whatever else was listening.

The slide is the old one's again as well, a sharp decelerate over
350ms, so the motion is the one the site had rather than a new one.

Left behind deliberately: `role="menu"` on a list of links, which wants
`menuitem` children to mean anything and reads worse than the labelled
`nav` around it. The toolbar attribute, the `open` attribute as an API,
and pausing media on close were never used here. History integration —
the back button closing the drawer — belonged to `amp-sidebar`, not to
the component this site loaded, so it was never ours to lose.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
PR-URL: #1857
Refs: #1856
@DerekNonGeneric

Copy link
Copy Markdown
Member Author

Superseded by #1857, which landed as 79b5fbe.

This one did not fix the bug. It waited on Bento's runtime and guarded
the slide, both keyed off click — and on iOS Safari that event never
arrives in the failing case. Safari holds a tap for a third of a second
in case a double-tap to zoom follows, and a second tap inside that wait
cancels both. Nothing keyed off click can reach that.

#1857 sets touch-action: manipulation, which is the only thing that
turns the wait off, drops the maximum-scale/minimum-scale the
viewport was asking for (iOS ignores them, and elsewhere they take
pinch-zoom from anyone who needs it), and replaces bento-sidebar with
markup and CSS so nothing crosses the button while it slides.

Closing unmerged; nothing here is worth keeping.

@DerekNonGeneric
DerekNonGeneric deleted the fix-mobile-sidebar-trigger branch August 25, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant