Repository navigation
💄🔧:make the sidebar open on the first tap - #1856
DerekNonGeneric wants to merge 3 commits into
Conversation
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
✅ Deploy Preview for gh-pages-openinf ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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
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
♿🔧: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
|
Superseded by #1857, which landed as 79b5fbe. This one did not fix the bug. It waited on Bento's runtime and guarded #1857 sets Closing unmerged; nothing here is worth keeping. |
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.orgwell 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:
The 350 ms slide drags other elements across the button
Tracing what sits under the hamburger after a tap:
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:
A press past 350 ms is a deliberate second press, so it still toggles.
Also in here
aria-expanded, kept in step by watching theopenattribute on the sidebar rather than by counting presses, so itstays right when the sidebar closes on the backdrop or on Escape;
aria-controlsnames what they operatelayout='nodisplay'is gone. It is an AMP attribute and Bento has nolayout 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 testpasses. To try it by hand,nps startand open the sitenarrow enough for the hamburger to show: tap it once, then tap it
several times quickly.