Skip to content
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

Make YouTube Embeds GDPR compliant #3253

Merged
merged 14 commits into from
Feb 7, 2022
Merged

Make YouTube Embeds GDPR compliant #3253

merged 14 commits into from
Feb 7, 2022

Conversation

julieg18
Copy link
Contributor

@julieg18 julieg18 commented Feb 2, 2022

  • adds a message about youtube's policys when a user hovers over a youtube embed.
  • For our video component, I just added a message below our overlay button. For our markdown, this is done by using a custom gatsby-remark-embed transformer and inserting a js script that handles taking off the message when the user has clicked.

To Do

  • Review the js implementation I used for the md embeds
  • Decide if the design is good enough for a first iteration at least
  • Take off the embeds's message across the site if the user has already clicked on play for one of the embeds (we can do something like this with localStorage)

* add custom youtube transformer to gatsby-remark-embedder
* add needed js and css code in doc/blog components
* add on hover message to overlay
@julieg18 julieg18 added the A: website Area: website label Feb 2, 2022
@julieg18 julieg18 self-assigned this Feb 2, 2022
@shcheklein shcheklein temporarily deployed to dvc-org-update-yt-embed-gugskw February 2, 2022 16:49 Inactive
@@ -0,0 +1,16 @@
const setUpCustomYtEmbeds = () => {
Copy link
Contributor Author

@julieg18 julieg18 Feb 2, 2022

Choose a reason for hiding this comment

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

This script takes all of our youtube embeds and attaches a click listener to our overlay. If the overlay is clicked, the video is played and the overlay disappears. It's definitely not very "reacty"... Does anybody have any ideas on how we could improve this?

Once we agree on a implementation (whether we deside to do this one or a different way) I want to have the code update local storage so that the message won't appear again if the user revisits the site :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Does anybody have any ideas on how we could improve this?

Bit of a shot in the dark, but is it possible to have the custom embedder return a custom tag like <youtube> and then attach a React component to our rehype-react custom components with this logic in it? That way we can use the remark-embedder style of automatic URL grabbing with React JS more consistent with the rest of the site.

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 could try that but wouldn't that only work for our docs pages? We'd probably want a solution that works the same for blog and doc 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point, I forgot about our weird divergent blog markdown.

* allow users to click on tooltip links
* update margin/font in Video component
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 3, 2022 14:06 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 3, 2022 16:21 Inactive
Copy link
Contributor

@yathomasi yathomasi left a comment

Choose a reason for hiding this comment

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

Great going @julieg18!

src/components/Blog/Post/index.tsx Outdated Show resolved Hide resolved
config/gatsby-remark-embedder/custom-yt-embedder.js Outdated Show resolved Hide resolved
Copy link
Contributor

@rogermparent rogermparent left a comment

Choose a reason for hiding this comment

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

I absolutely love the visual design on hover! Great stuff!

I think implementation could be improved a bit by my suggestion if possible, or if not at least @yathomasi's suggestion to use a hook for setUpCustomYtEmbeds (though I'm not sure how necessary it when events are added to elements in the body as opposed to window or document).

config/gatsby-remark-embedder/custom-yt-embedder.js Outdated Show resolved Hide resolved
@@ -0,0 +1,16 @@
const setUpCustomYtEmbeds = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does anybody have any ideas on how we could improve this?

Bit of a shot in the dark, but is it possible to have the custom embedder return a custom tag like <youtube> and then attach a React component to our rehype-react custom components with this logic in it? That way we can use the remark-embedder style of automatic URL grabbing with React JS more consistent with the rest of the site.

@rogermparent

This comment was marked as resolved.

@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 3, 2022 21:04 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 3, 2022 21:09 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 3, 2022 21:12 Inactive
@julieg18

This comment was marked as outdated.

@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 3, 2022 21:43 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 4, 2022 13:34 Inactive
@julieg18 julieg18 marked this pull request as ready for review February 4, 2022 13:34
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-gugskw February 4, 2022 14:13 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-tdlbwi February 4, 2022 15:47 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-tdlbwi February 4, 2022 16:16 Inactive
@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-71lby2 February 4, 2022 16:26 Inactive
@julieg18
Copy link
Contributor Author

julieg18 commented Feb 4, 2022

Updated the code based on everyone's comments and implemented localStorage! Once you click on a youtube embed (whether it's on the markdown or Video component), you won't see the message again on that browser.

Copy link
Contributor

@yathomasi yathomasi left a comment

Choose a reason for hiding this comment

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

The implementation looks great.
Just a small thing I noticed on anchor links on tooltips on the different on the homepage, docs, and blogs, especially on different hover states.
HomePage - links are underlined
Docs- links are not underlined and will get underlined on hover
Blogs - links are not underlined and will get gray(opacity lower) on hover

I am not sure how much difference it makes as it is just a one-time view for users. But, if we want to be consistent I think it's good how we show on HomePage (the links are differentiated with underline)

Copy link
Contributor

@rogermparent rogermparent left a comment

Choose a reason for hiding this comment

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

Looks good to me as well, all that's left is what @yathomasi pointed out with the overlays' links.

@julieg18 julieg18 temporarily deployed to dvc-org-update-yt-embed-71lby2 February 4, 2022 22:03 Inactive
@julieg18
Copy link
Contributor Author

julieg18 commented Feb 4, 2022

Just a small thing I noticed on anchor links on tooltips on the different on the homepage, docs, and blogs, especially on different hover states.

Thanks for spotting that! Updated all the styles, keeping them all consistent and added a focus style.

@julieg18 julieg18 merged commit dd9ad4d into master Feb 7, 2022
@julieg18 julieg18 deleted the update-yt-embeds branch February 7, 2022 13:47
@julieg18 julieg18 linked an issue Feb 7, 2022 that may be closed by this pull request
iesahin pushed a commit that referenced this pull request Apr 11, 2022
* Make all youtube embeds gdpr compliant with on hover message
* add custom youtube transformer to gatsby-remark-embedder
* add needed js and css code in doc/blog components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: website Area: website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Youtube Embeds GDPR compliant
4 participants