Showing results for 
Search instead for 
Did you mean: 

Accordion Alternative - Details tag

Jump to solution

Howdy! A friend showed me the details tag the other day and now I cannot stop telling others about it.

It's an HTML5 tag so it works in mobile too! See more at The Details disclosure element.

The spoiler reminds me of the details tag!

I added some styling to the main parts. Here is the code to try in your Canvas page:


 <summary style="background-color: whitesmoke; font-weight: bold; cursor: pointer;">
  Some question here? <small>(click to reveal)</small></summary>

 <div id="reveal" class="pad-box-mini border-round" style="border: thin solid grey;">
<p>Reveal text goes here</p>


I've already started using it on pages to split up large content blocks including video! I found the old places where the accordion was used and replaced each with its own details block.

Group of details to mimic an accordionGroup of details to mimic an accordion


Cheers - Shar

Labels (2)
22 Replies

How does "details disclosure" work with a number of paragraphs?


@adamboyce are you still there?

Well, it's about a week later and the long string URL is definitely a temporary .mp4. So it's back to using the classic RCE video player. Here are the instructions I've documented for Including a Canvas embedded video under the details tag.

  1. Record or upload video in the New RCE as per usual.
  2. Switch to HTML editor to grab the data-media-id
    <iframe style="width: 400px; height: 225px; display: inline-block;"
      title="Video player for Shar 5 seconds" data-media-type="video"
      allowfullscreen="allowfullscreen" allow="fullscreen"
  3. Replace the iframe code with media comment link set in a 400px wide div. This canvas-video div will display the video under the details tag...
    <summary>Commentary Video (click to reveal)</summary>
    <div id="canvas-video" style="max-width: 400px;"><a
      class="instructure_inline_media_comment video_comment"
      data-media_comment_type="video" data-alt=""></a></div>

Incidentally, using the classic RCE video player also makes it easier to add captions. The instructions for captions has one using the temporary .mp4 in Amara.

Stay home, stay healthy,
Cheers - Shar

View solution in original post

Tags (2)
0 Kudos

Thanks @Shar! That worked in desktop and mobile! Although the preview image of the video did not load on mobile, it still displayed the play button and played the video just fine. Yes, it is an FAQ page and should be constant when we duplicate the course. 

I really appreciate your time and insights!

View solution in original post

0 Kudos

Hi again again @adamboyce 

By the way, have you looked at the videos on mobile? The Canvas media comment videos show up as regular videos in mobile ready to view with a press of the play button (yay!).

It's the iframe tag that's definitely causing the issue, more specifically the iframe video player, the html5 video tag works so much better under the details. But the src is an ugly long string; I'm guessing that's the reason they made a media_objects_iframe directory.

<p><video name="media" width="400" height="225" controls="controls">
type="video/mp4" /></video></p>

I've truncated the src URL in the above snippet because it's such a hideous run of characters including an expiration date that seems to be from when I generated the string. At any rate, here's what I did to get the video code and source.

  1. in New RCE, embedded the course video on the page.
  2. Saved the page.
  3. Right-click on video and select Open video in a new tab
  4. In the new tab, Right-click on video and select Inspect
  5. In the inspect frame, Right-click on video tag and select Copy element
  6. Back to Canvas page, Edit,  switch to HTML editor. Paste in code before closing details tag.
  7. Switch to RCE to allow Canvas to update the code
  8. Switch back to HTML, edit width to 400 and height to 225.
  9. Saved the page.
  10. Looked at it on the Canvas mobile app.

Yeah, that's a lot of work for a possibly persistent video tag under a details. But if your page is going to be stable and no one else is going to go in and mess with it, then it's worth a shot at doing. Are you making an FAQ page? Is that video going to remain in the course?

I'm going to keep my test page and set a reminder to see if it's still viable tomorrow and in three months.
I hope this helps you out, I know I'm going to document the process for the future when the New RCE is the only thing available.
Cheers - Shar

View solution in original post

Tags (2)

Hi again @adamboyce ,

Ahh I think it's definitely something with the new video player used in the new RCE. I just tried it and yeah, in the edit mode the video shows up, but once we press save it fails to load. I suspect it's something to do with the order that things load in.

At any rate, for the old video, I slipped a <div style="max-width: 400px;"> </div> around the <a> </a> and that keeps my video the same size as the new media player. I'm still going to keep messing around with the new video player to see what I can come up with, otherwise, we'll have to remember the link to data-media-id trick.

Cheers - Shar

View solution in original post

Using your code adjusting the data-media-id worked (m-65j3H4tZuFcGyhqFmu7XNa4qZH1ifswA), however the video shows up as a small thumbnail and then expands to almost the entire screen when clicked. I noticed the media player is also different. I probably need to play with the style to figure out the sizing issues, but this is definitely a good workaround if there really is no way for the iframe to be active under the details tag. Thanks @Shar!

classic media player:


iframe media player: 



View solution in original post

Yes, I'm using the New RCE and added previously recorded course media via the dropdown menu pictured. I'll try out some of the code you've provided, but mine is below.

 Screenshot 2020-12-02 161152.png

<hr />
<summary><strong>What if I need to miss a week?</strong></summary>
You're in a pickle <iframe style="width: 400px; height: 225px; display: inline-block;" title="Video player for [Untitled Wed Sep 23 2020 15:16:30 GMT-0600 (Mountain Daylight Time)]" data-media-type="video" src="https://*ourinstitution*" allowfullscreen="allowfullscreen" allow="fullscreen" data-media-id="m-65j3H4tZuFcGyhqFmu7XNa4qZH1ifswA"></iframe>
<hr />

View solution in original post

0 Kudos

Hi there @adamboyce !

Hmm, I had some trouble recently trying to put H5P content (hotspot type) under a details tag; the content would not display. But I've used the details tag successfully with YouTube video.

I just tried it now with a quick Canvas record-video and no problem there either. Here's what I did:

  1. HTML Mode, set up the details, summary, and placeholder text for the video
  2. Classic RCE, used the Record/upload media button at my placeholder video text
  3. Saved and waited for the video to process.
<summary>Example Video from Shar</summary>
<p>Video here</p>
<p><a id="media_comment_m-2cVzH7FEMypuA6Krirf7KmRFWwgpNWTz"
class="instructure_inline_media_comment video_comment"
data-media_comment_type="video" data-alt=""></a></p>

No iframe at all with that content. Here's the code I used for my YouTube video. I use a method of inline responsive-embedding that limits the video width so it's not overly huge on really large screen displays.

<summary>Prototyping for better eLearning: Part 1 (8:26)</summary>
<div id="outer" style="max-width: 640px; margin: auto;">
<div class="embed-container"
style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%;">
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"

What kind of media are you using? Are you using the new RCE? Perhaps there's some issue there that I'm unaware of with the use of iframes.

Let me know, I'm happy to help you troubleshoot. Paste your code if you can. 😊
Cheers - Shar

View solution in original post

Tags (2)
Surveyor II

I've been using the details tag thanks to your insight @Shar! However, when I insert course media it doesn't show after saving... You mentioned videos worked in your description, so any advice would be awesome.

Do I need to be in the html editor rather than the RCE when inserting the iframe for some reason?

View solution in original post

Tags (3)
0 Kudos

Has anyone been successful in using the <details open> attribute to have the details be displayed when the page is loaded?   I'd like to have a section of details a page be displayed upon page load, but then have a user be able to close.   It appears that Canvas removes the open from the html, leaving the default closed state.

View solution in original post

0 Kudos