Skip to content

Commit af49d70

Browse files
committed
Migrate Reflow videos to WAI Understanding WCAG YouTube account
1 parent e22d551 commit af49d70

File tree

7 files changed

+39
-16
lines changed

7 files changed

+39
-16
lines changed

_includes/youtube.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% comment %}
2+
<!-- (HTML comment markup included to avoid confusing syntax highlighting)
3+
4+
Based on https://adrianroselli.com/2024/01/embed-slides-youtube-videos-and-more.html#YouTube
5+
6+
Inputs:
7+
- src, height, width = respective attribute values from YouTube's embed code
8+
- title = Desired title attribute value
9+
10+
Procedure:
11+
1. Go to YouTube video page
12+
2. Right-click the video, then choose "Copy video embed code"
13+
3. Paste the code where you want to insert the video
14+
4. Replace `<iframe` with `{% include "youtube.html",`
15+
5. For each of width, height, and src, replace the `=` with `: ` and add `, ` after
16+
- e.g. `width: "...", height: "...", src: "...", `
17+
6. Delete the remaining embed code, and add `title: "..."` with your desired text alternative
18+
7. End with ` %}`
19+
20+
(Backticks are used as delimiters in the above instructions; do not include them in your code.)
21+
-->
22+
{% endcomment %}
23+
{% assign id = src | replace: "https://www.youtube.com/embed/", "" %}
24+
{% assign embedUrl = "https://www.youtube-nocookie.com/embed/" | append: id | append: "?autoplay=1&mute=1&rel=0" %}
25+
<iframe
26+
title="{{ title | escape }}"
27+
style="aspect-ratio: {{ width }} / {{ height }}; max-width: 400px;"
28+
width="{{ width }}"
29+
src="{{ embedUrl }}"
30+
allow="autoplay"
31+
allowfullscreen
32+
loading="lazy"
33+
srcdoc="&lt;style&gt;body{background-image:url(https://i3.ytimg.com/vi/{{ id }}/hqdefault.jpg);background-repeat:no-repeat;background-size:cover;background-position:center center;display:grid;place-items:center;min-height:97dvh;overflow:hidden;}a{display:block;width:96px;height:96px;overflow:hidden;}a:focus{outline:none;}a:focus circle,a:hover circle{fill:#000;}a:focus circle:first-child + circle,a:hover circle:first-child + circle{stroke-dasharray:.4,.4;}a:focus polygon,a:hover polygon{stroke:#fff;stroke-width:.75;}&lt;/style&gt;&lt;a href='{{ embedUrl }}'&gt;&lt;svg viewBox='0 0 16 16' width='96' height='96' xmlns='http://www.w3.org/2000/svg' aria-hidden='true'&gt;&lt;circle cx='50%' cy='50%' r='7.75' fill='none' stroke='#000' stroke-width='.5'/&gt;&lt;circle cx='50%' cy='50%' r='7.25' fill='none' stroke='#fff' stroke-width='.5'/&gt;&lt;circle cx='50%' cy='50%' r='7' fill='#0009'/&gt;&lt;polygon points='12, 8 6, 4.5 6, 11.5' fill='#fff' stroke-linejoin='round'&gt;&lt;/polygon&gt;&lt;/svg&gt;Play&lt;/a&gt;"
34+
{{ attribs }}></iframe>
-9.02 MB
Binary file not shown.

understanding/21/img/code-diff.gif

-4.21 MB
Binary file not shown.
-11.4 MB
Binary file not shown.
-2.51 MB
Binary file not shown.
-1.98 MB
Binary file not shown.

understanding/21/reflow.html

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ <h2>Basic text reflow</h2>
4444
<p>Users who need to enlarge (zoom) text to read it benefit significantly when it reflows. Regardless of the size of the text, it continues to wrap within the visible viewport. A whole line of text is visible, making it easier for the eye to track from the end of one line to the start of the next. Users only need to scroll in the direction of reading to read additional lines of text.</p>
4545

4646
<figure>
47-
<video controls style="max-width:400px" title="A quotation beginning 'It was a dark and stormy night...' becomes larger on the screen, but before a word at the end of a line grows too long to fit in the width of the container, it wraps to the next line.">
48-
<source src="img/reflow-text-resize.mp4" type="video/mp4">
49-
</video>
47+
{% include "youtube.html", width: "1038", height: "584", src: "https://www.youtube.com/embed/5oHRHMpezyc", title: "A quotation beginning 'It was a dark and stormy night...' becomes larger on the screen, but before a word at the end of a line grows too long to fit in the width of the container, it wraps to the next line." %}
5048
<figcaption style="max-width:400px">
5149
<p>As text is resized, the words wrap so that the text lines do not exceed the viewport. (This quick demo to 200% is not intended to illustrate a test for conformance.)</p>
5250
</figcaption>
@@ -55,10 +53,7 @@ <h2>Basic text reflow</h2>
5553
<p>This criterion requires non-excepted sections of content that are written in horizontal languages reflow when narrowed to a width equivalent to 320 CSS pixels. Similarly, sections of content that are written in vertical languages (which are not as commonly used on the web and so will be used much less frequently in examples) need to be able to reflow when rendered at a height equivalent to 256 CSS pixels.</p>
5654

5755
<figure>
58-
<video controls style="max-width:400px" title="As a window displaying the quotation 'It was a dark and stormy night...' becomes thinner, a word at the end of a line wraps to the next line before it exceeds the width of the window.">
59-
<source src="img/reflow-container-resize.mp4" type="video/mp4">
60-
</video>
61-
56+
{% include "youtube.html", width: "1038", height: "584", src: "https://www.youtube.com/embed/N6kIiLHAH3k", title: "As a window displaying the quotation 'It was a dark and stormy night...' becomes thinner, a word at the end of a line wraps to the next line before it exceeds the width of the window." %}
6257
<figcaption style="max-width:400px">
6358
<p>As the container for the text is reduced in width, the words wrap so that the text lines do not exceed the container width. (This quick demo is not intended to illustrate a test for conformance.)
6459
</figcaption>
@@ -119,9 +114,7 @@ <h4>Carousels and carousel-like widgets</h4>
119114
</figure>
120115

121116
<figure>
122-
<video controls style="max-width:400px">
123-
<source src="img/carousel-fail.mp4" type="video/mp4">
124-
</video>
117+
{% include "youtube.html", width: "597", height: "584", src: "https://www.youtube.com/embed/67fh_MUydhw", title: "Scrolling through a carousel reveals that its second panel is unable to fully fit within the viewport, requiring horizontal scrolling to read all of its content." %}
125118
<figcaption>
126119
<p>Fail: In this modified version of the previous carousel, the second panel's content <strong>does not</strong> fit within the 320 CSS pixel viewport.</p>
127120
</figcaption>
@@ -133,11 +126,7 @@ <h4>Two column presentation of editing changes</h4>
133126
<p>Being able to review differences in code, or text, side-by-side can be an instance where a scrolling two-column layout can benefit users.</p>
134127

135128
<figure>
136-
<video controls style="max-width:400px">
137-
<source src="img/code-view-columns.mp4" type="video/mp4">
138-
</video>
139-
140-
<!-- <img src="img/code-diff.gif" alt="code editor, showing code lines 20 to 24. The differences between the original code and the modified code are presented as two columns, with the original on the left and the modified on the right. This animated gif demonstrates horizontally scrolling each column of code into view - within a 320 pixel wide viewport - where vertical scrolling is used to show that the full text of each column can then be read by scrolling in a single direction."> -->
129+
{% include "youtube.html", width: "659", height: "584", src: "https://www.youtube.com/embed/OpeC70mJBaM", title: "Code editor, showing a diff between line 23 in the original code and 22 in the modified code. The differences between the two are presented as two columns, with the original on the left and the modified on the right. Each column can be completely scrolled into view horizontally within a 320 pixel wide viewport. Text within each column can then be read by scrolling only in the vertical direction." %}
141130

142131
<figcaption>
143132
<p>Pass: An interface to review code/document changes provides a two-column comparison between the original and modified content. Each column fits within a 320 CSS pixel wide container and a horizontal scrollbar can be used to position each column into the visible viewport.</p>
@@ -330,7 +319,7 @@ <h2>Examples</h2>
330319
<ul>
331320
<li>
332321
<strong>One column view in responsive design</strong>
333-
<p><video controls="controls"><source src="https://alastairc.uk/w3c/reflow-example-1-BBC.mp4" type="video/mp4" /><source src="https://alastairc.uk/w3c/reflow-example-1-BBC.ogv" type="video/ogg" />Animation of zooming in on a responsive site. The content reflows to fit the screen.</video></p>
322+
<p>{% include "youtube.html", width: "978", height: "584", src: "https://www.youtube.com/embed/fWRL6NtHvZQ", title: "Animation of zooming in on a responsive site. The content reflows to fit the screen." %}</p>
334323
<p>Note that as the zoom percentage increases, the navigation changes first to hide options behind a &quot;More&quot; dropdown menu. As zooming continues, most navigation options are eventually behind a &quot;hamburger&quot; menu button. All the information and functionality is still available from this web page. There is no horizontal scrolling.</p>
335324
</li>
336325
<li>

0 commit comments

Comments
 (0)