hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.89k stars 16.65k forks source link

TikTok embeds are not interactive #3416

Closed itsameandrea closed 1 year ago

itsameandrea commented 1 year ago

Hey! Thank you so much for your work on Reveal. I just spotted an issue with TikTok embeds.

I have this Revel presentation

    <main class="h-screen relative">
      <div class="w-full h-full">
        <div class="reveal bg-gray-100" data-controller="slides">
          <div class="slides">
            <section>
              <div class="relative w-full rounded-lg" style="padding-bottom: 56.49999999999999%;" data-controller="youtube" data-youtube-start-value="0" data-youtube-end-value="10" data-youtube-id-value="c0nvcyhhwkc">
                <div class="absolute top-0 left-0 w-full h-full border-0 rounded-lg" data-youtube-target="video"></div>
              </div>
            </section>
            <section>
              <div class="h-[575px] overflow-hidden w-fit mx-auto rounded-lg">
                <blockquote class="tiktok-embed" cite="https://www.tiktok.com/@hd.footballsoccer/video/7222285723372719406" data-video-id="7222285723372719406" data-embed-from="oembed" style="max-width: 605px;min-width: 325px;">
                  <section>
                    <a target="_blank" title="@hd.footballsoccer" href="https://www.tiktok.com/@hd.footballsoccer?refer=embed">@hd.footballsoccer</a>
                    <p>The Magic of Martin Odegaard <a title="football" target="_blank" href="https://www.tiktok.com/tag/football?refer=embed">#football</a>
                      <a title="soccer" target="_blank" href="https://www.tiktok.com/tag/soccer?refer=embed">#soccer</a>
                      <a title="moments" target="_blank" href="https://www.tiktok.com/tag/moments?refer=embed">#moments</a>
                      <a title="magic" target="_blank" href="https://www.tiktok.com/tag/magic?refer=embed">#magic</a>
                      <a title="odegaard" target="_blank" href="https://www.tiktok.com/tag/odegaard?refer=embed">#odegaard</a>
                    </p>
                    <a target="_blank" title="♬ Love You So - The King Khan & BBQ Show" href="https://www.tiktok.com/music/Love-You-So-6728562975734515713?refer=embed">♬ Love You So - The King Khan & BBQ Show</a>
                  </section>
                </blockquote>
                <script async src="https://www.tiktok.com/embed.js"></script>
              </div>
            </section>
          </div>
        </div>
      </div>
    </main>

That is initialised via a stimulus controller

initReveal() {
    let deck = new Reveal({
      plugins: [ Markdown ]
    })

    deck.initialize({
      width: 1500
    })
  }

The YouTube video is embedded using their iframe API, whereas the TikTok embed HTML is coming straight from their oembed endpoint. The YouTube video works as expected whilst the TikTok embed is rendered but cannot be interacted with.

I tried to play around with z-index values but that didn't really lead me anywhere. Any idea of how I may go about it?

itsameandrea commented 1 year ago

Turns out that was because the iframe was inheriting the CSS property pointer-events: none from .reveal .slides.

I wrapped the embed HTML with this

<div class="pointer-events-auto">
</div>

And that seems to do the trick