-
Notifications
You must be signed in to change notification settings - Fork 236
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
base: latest
Are you sure you want to change the base?
Conversation
<noscript> | ||
<Message message={noJsMessage} /> | ||
</noscript> |
There was a problem hiding this comment.
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?
<noscript> | |
<Message message={noJsMessage} /> | |
</noscript> | |
...(noJsMessage && { | |
<noscript> | |
<Message message={noJsMessage} /> | |
</noscript> | |
} | |
) |
There was a problem hiding this comment.
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 /> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> | ||
<div><div class="bbc-1mgo2mg"><strong class="bbc-pow7hy">Ntibishobora gukina mu cuma cawe</strong></div></div> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. <div><div
etc
There was a problem hiding this comment.
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!
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
Testing
Disable JS and navigate to http://localhost:7080/hausa/bbc_hausa_radio/liveradio
The No JS message should be displayed as expected