Skip to content

fix: videos in blog post didn't load when navigating to them within the#1063

Merged
ngnijland merged 2 commits into
masterfrom
fix--video-load-on-navigation
Jun 24, 2026
Merged

fix: videos in blog post didn't load when navigating to them within the#1063
ngnijland merged 2 commits into
masterfrom
fix--video-load-on-navigation

Conversation

@ngnijland

@ngnijland ngnijland commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Video's on the blog detail pages did not load when navigating to the pages via links within the website. They only loaded when directly navigating to the blog detail page.

The cause was that these video elements use source elements as child elements. On load a browser handles this by getting the src from the source and adding it to the video element. But after our first website load, JavaScript takes over, so this behavior stopped working after the first load. The fix is to manually load the video's on the Astro after:page-swapped event (replaces window load event).

@ngnijland ngnijland marked this pull request as ready for review June 24, 2026 12:44
@ngnijland ngnijland requested a review from Copilot June 24, 2026 12:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an Astro client-side navigation issue where <video> elements using child <source> tags don’t load when navigating to blog detail pages via the site router (as opposed to direct page loads).

Changes:

  • Add a client-side navigation hook (astro:after-swap) to force <video> source selection by calling video.load() for eagerly-sourced videos.
  • Update feature grid links to include a trailing slash.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
docs/src/layouts/Base.astro Adds reloadSwappedVideos() and runs it on astro:after-swap to ensure blog videos load after client-side navigation.
docs/src/layouts/partials/FeatureGrid.astro Adds trailing slash to feature links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/src/layouts/Base.astro
Comment thread docs/src/layouts/partials/FeatureGrid.astro
@ngnijland ngnijland force-pushed the fix--video-load-on-navigation branch from aa44312 to 86e52b6 Compare June 24, 2026 12:57
@ngnijland ngnijland merged commit d928b34 into master Jun 24, 2026
1 check passed
@ngnijland ngnijland deleted the fix--video-load-on-navigation branch June 24, 2026 13:12
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.

2 participants