Repository navigation
fix(ui): the drawer's views flicker in halfway down the panel inside an embed - #312
Merged
Merged
Conversation
Reported on a WordPress embed: navigating, the panel's content flickered in halfway down, then jumped to the top. `AnimatePresence mode="popLayout"` pops the outgoing view out of flow with a `<style>` framer-motion appends to `document.head` — the host's head, which cannot reach into the widget's shadow root (#236). So in every embed both views stayed in the flex column for the whole fade, each taking half the panel, and each transition left a `<style>` in the host's <head> for its duration. Measured on the live page: the incoming view at 344px of a 688px panel, the host's head 31 → 32 styles mid-fade. `ViewLayer` fills the sheet absolutely, so the two views overlap for the fade and need no stylesheet. The outgoing layer also drops pointer events and leaves the accessibility tree the moment it starts to exit. A lint rule refuses `popLayout` in shipped code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t no longer writes Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying sahajatlas with
|
| Latest commit: |
0975c5a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://71a741b2.sahajatlas.pages.dev |
| Branch Preview URL: | https://fix-embed-transition-flicker.sahajatlas.pages.dev |
sydevs-bot
pushed a commit
that referenced
this pull request
Oct 26, 2026
… layer The ticket's 25px float is real, and an isolated harness cannot see it. Measured on this PR's own deployed preview at 390x844: the bar's bottom edge sat at 818.69 against an 844 viewport, with the panel's own content showing through the 25.31px strip underneath -- exactly as reported. The cause is the containing block, not the arithmetic. `bottom: var(--sy-sheet-top)` cancels vaul's translate only while it is measured from the sheet's own bottom edge. `absolute` resolves against the nearest POSITIONED ancestor, and since #312 the view crossfade puts two of them between the sheet and the view: `relative min-h-0 flex-1` and `absolute inset-0 flex flex-col`, both filling the sheet's CONTENT box, which its `pb-[calc(var(--sy-frame-h)*0.03)]` ends 25.32px above its border box. Walked on the preview: footer 668.69-818.69, crossfade layer 564-1362.69, sheet 544-1388. `fixed` resolves against the nearest ancestor with a transform instead, and that is the sheet -- vaul writes `translate3d` on it and `will-change: transform` with it. So the offset is measured from the box it was always meant to be measured from, whatever DrawerStack nests in between, and the 3% never has to be named. Subtracting the 3% instead would have been correct only for the current nesting, and 25px too low for a view that composes its footer directly under DrawerContent. ⚠ I reported this symptom as not reproducing, in the first commit on this branch and in the PR body. That was wrong, and the way it was wrong is the useful part: the Ladle probe I measured in composes `DrawerFooter` straight under `DrawerContent`, so it had no crossfade layer to resolve against and the bar measured flush. Both docblocks and the spec now carry the correction, and the spec says why an isolated harness is not evidence here. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SHjmUonsTYZg2xiQ7e7yqY
sydevs-bot
pushed a commit
that referenced
this pull request
Oct 26, 2026
`parentElement` was bound to `sheet`, 20 lines under a docblock saying the view crossfade (#312) sits between the sheet and the footer. Both cannot be true, and the next author reasons from the mechanism: the parent is the crossfade layer, so the name is `layer`. Publishing per layer is the right scope, and that is now stated rather than implied. On the sheet, one value would be shared by both crossfade layers, and the outgoing layer's cleanup would blank the incoming footer's value mid-fade. The contract it buys was unstated and is the part a later composition can break: a `sticky` footer's parent must also contain the body it clears. Anywhere it does not, the clearance resolves to its `0px` fallback and the content ends under the bar, with nothing failing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0198xNcXbYVmd5prap54yrHB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<style>into the host page's<head>Reported on the WordPress embed at
shrimataji.org/…/?atlas=/br/distrito-federal. It is a regression from the move into the shadow root (#236) and hits every embed. sahajatlas.com was unaffected, since it has no shadow root.Change outline
Components — the drawer's view cross-fade
AnimatePresence mode="popLayout"takes the outgoing view out of flow by appending a<style>todocument.head. In an embed that is the host's head, and it cannot style elements inside the widget's shadow root. So nothing was popped: both views shared the sheet's flex column for the whole fade. Each took half the panel, and the new one sat in the lower half.Behaviour — a lint rule
eslint.config.js + src/**/*.tsx (shipped code): no-restricted-syntax refuses the literal "popLayout"Neither layout nor the host's
<head>is visible to jsdom, so a lint rule is what stopspopLayoutfrom coming back.Preview
⚠ This standalone preview has no shadow root, so it never showed the flicker. I re-ran the trace with this preview served in place of sahajatlas.com on the tester's live page. Mid-fade, both views were at 1px, and the host's
<head>stayed at 31 styles. Any embed host can run the same check with SahajAtlasWordpress's browser lane andSAHAJ_ATLAS_WIDGET_FROM=https://pr-312-sahajatlas.contact-c66.workers.dev.Contract impact
Hosts no longer get a framer-motion
<style>in their<head>while the drawer changes view. That injection was never documented, and it is whatdocs/embedding.mdalready says the widget does not do. The entry is inCHANGELOG.md, and no snippet, origin or CSP row changes.Test results
lint+typecheck+test:run) ✓, with 148 files and 1755 tests, and 3 consecutive full-lane runs greenViewLayer.test.tsx, in jsdom inside a shadow root:aria-hiddenandpointer-events-nonemid-fade;mode="popLayout"inDrawerStack.tsx.pnpm size✓: embed 312.4 / 318 KiB.Manual verification
Measured on the tester's page in Chromium at 1280px, sampling every frame for 700ms after a real mouse click:
<head>styles mid-fadearia-hidden), incoming at 1pxNotes for reviewer
scrollYand every scroll offset inside the widget held still. Nothing in our source or bundle scrolls the page. The scroll reportedly aligns to the position the new view flickered to, which no longer exists after this fix. If the report comes back, the browser and the exact clicks are what's needed.clickevent, while the same click on sahajatlas.com did. A minimal page showed WebKit dropsclickwhen pointer capture is set on another element duringpointerdown. Worth checking in real Safari before filing.Detail
rootprop that would put the<style>inside the shadow root. That is a three-major upgrade that still installs a<style>element, so I overlapped the layers absolutely instead.inset-y-0,h-[var(--sy-frame-h)], orfilled), so absolutely positioned layers inside aflex-1wrapper size exactly as the in-flow view did.requestAnimationFrameinvi.hoisted. framer-motion reads it when it loads, so per-test fake timers never reached it, and under the loaded lane the 150ms exit sometimes finished before the assertions ran.🤖 Generated with Claude Code