10000 WORLDSERVICE-306: Implement No JS message for media loaders without placeholders by karinathomasbbc · Pull Request #12270 · bbc/simorgh · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

WORLDSERVICE-306: Implement No JS message for media loaders without placeholders #12270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: latest
Choose a base branch
from

Conversation

karinathomasbbc
Copy link
Contributor
@karinathomasbbc karinathomasbbc commented Jan 13, 2025

Resolves JIRA https://jira.dev.bbc.co.uk/browse//WORLDSERVICE-306

Overall changes

Displays a translated message instead of the media player (along the lines of: "To play this content, please enable JavaScript, or try a different browser") if Javascript is disabled

Code changes

  • Add a noscript block to the media container, so that the No JS message can be rendered as expected

Testing

Disable JS and navigate to http://localhost:7080/hausa/bbc_hausa_radio/liveradio
The No JS message should be displayed as expected

Screenshot 2025-01-13 at 14 54 04

@karinathomasbbc karinathomasbbc self-assigned this Jan 13, 2025
@karinathomasbbc karinathomasbbc changed the title Implement No JS message for media loaders without placeholders WSTEAM1-1581: Implement No JS message for media loaders without placeholders Jan 13, 2025
@karinathomasbbc karinathomasbbc changed the title WSTEAM1-1581: Implement No JS message for media loaders without placeholders WORLDSERVICE-306: Implement No JS message for media loaders without placeholders May 1, 2025
@karinathomasbbc karinathomasbbc marked this pull request as ready for review May 1, 2025 16:01
Comment on lines +174 to +176
<noscript>
<Message message={noJsMessage} />
</noscript>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this always have some kind of fallback (e.g. an english version of the message)? I thought it would be the translations?.media?.noJs but the optional chaining implies we might not always have a translation.
If not, maybe this should conditionally render based on whether there is a message passed in at all?

Suggested change
<noscript>
<Message message={noJsMessage} />
</noscript>
...(noJsMessage && {
<noscript>
<Message message={noJsMessage} />
</noscript>
}
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me have a think, and look at what we do elsewhere in the application. I think an English fallback would be better than not seeing the component at all, but let me check.

@@ -1118,7 +1118,9 @@ exports[`Radio Page Main should match snapshot for Canonical 1`] = `
<div
class="emotion-10"
data-e2e="media-player"
/>
>
<noscript />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be blank? It seems like every service does have a noJSMessage translation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... not sure if it should be blank - let's see what went wrong 🙃

/>
>
<noscript>
&lt;div&gt;&lt;div class="bbc-1mgo2mg"&gt;&lt;strong class="bbc-pow7hy"&gt;Ntibishobora gukina mu cuma cawe&lt;/strong&gt;&lt;/div&gt;&lt;/div&gt;
Copy link

Choose a reason for hiding this comment

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

@karinathomasbbc is this what you expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe so? Shouldn't the noscript + message always be there, in case javascript is disabled?

Copy link
@greenc05 greenc05 May 2, 2025

Choose a reason for hiding this comment

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

Sorry I mean did you expect it to look like this? e.g. &lt;div&gt;&lt;div etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh yes OK. Let me see if it happens in other components & whether it's a jest snapshot thing, or whether it's a code problem. Thanks!

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.

3 participants
0