Adds a Share button that uses the Share API with the URL to the current post
Adds logic in stream to determine whether the share buttons should be rendered
Adds functionality to focus on post title when visiting a shared url
Overrides cookie banner force focus behaviour for shared urls
Adds yarn dev-https script to use HTTPS locally via Next.js, as share API is only available in secure contexts, so testing on a local network with IP address will work.
Adds post query param for share link tracking
Adds unit tests
Testing
There are currently some a11y issues, which I haven't managed to find a fix for:
VoiceOver iOS, after exiting share window, VoiceOver takes over focus back to top of page, not respecting forced focus code
Sometimes Webkit browsers don't respect the code that automatically brings focus back to the share button that was clicked after the share prompt is closed, usually happens after tapping 2 or 3 share buttons
Resolves JIRA https://jira.dev.bbc.co.uk/browse/WSTEAM1-989
Overall changes
Adds a Share button for Live page posts.
Code changes
yarn dev-https
script to use HTTPS locally via Next.js, as share API is only available in secure contexts, so testing on a local network with IP address will work.Testing
There are currently some a11y issues, which I haven't managed to find a fix for:
Helpful Links
Add Links to useful resources related to this PR if applicable.
Coding Standards
Repository use guidelines