Fix: update every live badge and observe elements for resize - #40
Merged
Merged
Conversation
The landing page marked two badges with the same id, so getElementById updated only the first and the badge demo's live value never changed. Key both live badges off data attributes and write to every match. Pause the badge interval while the document is hidden. Replace the window resize listeners behind the phone widget fit and the scrollable-table affordance with ResizeObserver. Both measure elements that resize with the content column, not with the viewport. This also moves the table script out of a concatenated string in the Astro config into a typed script in the Starlight head component.
Deploying stackyard-docs with
|
| Latest commit: |
a936429
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://73394c42.stackyard-docs.pages.dev |
| Branch Preview URL: | https://fix-live-badge-ids-and-resiz.stackyard-docs.pages.dev |
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
id="seerrCount"andid="jellyfinCount"hooks withdata-live-seerr/data-live-jellyfinattributes, and update every matching node instead of the single elementgetElementByIdreturned.visibilitychange, so it stops while the document is hidden.ResizeObserveron.screen-inner, dropping the windowresizelistener and its manualrequestAnimationFramecoalescing.astro.config.mjsinto a typed<script>in the Starlight head component, and observe each.sy-tscrollbox with aResizeObserver.Testing
All green:
npm run buildandnpm run checkboth pass. Verified over CDP in headless Chrome: both Seerr badges now tick in lockstep and no duplicate ids remain; the table affordance tracks live resizes in both directions across five docs pages at 380/500/700px, in both docs themes; the phone scale variables are set at 390px and cleared at 1280px. Screenshots taken at 390px and 1280px on the landing page and at 380px on the badges page in both colour schemes.Checklist
npm run buildandnpm run checkboth pass.