Repository navigation
Demos: a quiet prop for pages that show many at once - #27
Merged
Merged
Conversation
`quiet` — the demo is one of many on a page: nothing may open, move, play sound or steal focus by itself. A demo without automatic behaviour ignores it. ModalDemo honours it: the offer (delay/scroll) and exit-intent modals lose their automatic config, each card gets an opener button, and the quiet copies remember under their own key so a press on the hub never hides the automatic ones on /modal/. Without quiet the render is byte-identical. The gallery index passes quiet to every demo. check-modal-and-bar pins both renders, with two planted faults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The contract
Every demo now takes an optional
quiet?: boolean(default false), documented besideassetBaseinsrc/components/demos/index.tsand the README:An element's own page never passes it, because there the automatic behaviour is the point. The superherotech.ai
/elements/hub will pass it (separate site PR). This gallery's index now passes it too, since it is the same kind of page.Which demos honour it
modal is the only one. With
quiet:demo-modal-offeranddemo-modal-exitrender with nodelay,scrollorexit.modal:<id>:quiet. A visitor who opens and closes one on the hub still gets the automatic one on/elements/modal/.Without
quiet,dist/modal/index.htmlis byte-identical to main.Reviewed and left alone
preload="none"with no autoplay.One judgment call needs your eye. The contract says "move", and the brief put self-contained autoplay under reduced motion in the fine column. I read "move" as the page or something over it moving, not motion inside the demo's own box. If the hub should also stop the carousels, their demos can drop
autoplayunderquietin a follow-up.Checks
scripts/check-modal-and-bar.mjshas a new stage, 4b. It reads the gallery (ModalDemo withquiet) and/modal/(without it):quiet, it asserts that nodata-mdconfig carries a delay, a scroll or exit. The two opener buttons must exist with their labels andtype="button", and the memory keys must differ from the element page's.quiet, it asserts that both automatic configs are exactly as before and that the "Forget it" buttons are present.The full
npm run checkchain is green.I also ran headless Chrome against the built gallery. After 22 seconds, a scroll past half the page and an exit-intent attempt, nothing had opened. Both buttons opened their modals and focus returned to the opener. On
/modal/, the offer still opened by itself on scroll.The Modal element itself (
src/library/modal/Modal.astro) is untouched.🤖 Generated with Claude Code