Skip to main content

Test YouTube and Google Maps embeds for accessibility

Published: •5 min read•navable Team
AccessibilityYouTubeGoogle MapsKeyboardiframe

You tab to “Load content” and press Enter. The video appears and the button disappears, taking the focus indicator with it. You have to press Tab again to see where focus goes.

So test a click-to-load embed twice. Before loading, check that you can reach the button with a keyboard and tell what it will load. Afterwards, check where focus lands and whether the iframe has a name that describes its contents. An automated scan catches only part of this. WCAG 2.2 on keyboard access · WCAG 2.2 on focus order

Try loading the video with your keyboard

In each example, tab to the button for the workshop tour and press Enter. In the first, focus falls back to the page. In the second, it moves to “Video loaded: Workshop tour.” Both examples load a local text sample inside the iframe. Use “Return to placeholder” to try again.

Example that loses focus

Workshop tour

Local simulation of a YouTube placeholder. The button loads a text sample.

Loading removes the button. Focus falls back to the page and the embedded video has no accessible name.

Example with a focus target

Workshop tour

Local simulation of a YouTube placeholder. The button loads a text sample.

Focus moves to “Video loaded.” The iframe has a title that identifies its contents.

If your implementation removes the button, move focus to a visible heading or short message just before the iframe after rendering it. Give that text tabindex="-1" so you can focus it with JavaScript without adding a tab stop. Check where Tab and Shift+Tab take you next. If the button stays visible and usable, you can keep focus there and announce the change through a status message.

Don't focus the iframe itself by giving it tabindex="-1". In our test, which also checked the frame's contents, axe-core reported this as frame-focusable-content. The rule says a frame with interactive content should not have tabindex="-1".

Give the button and iframe their own names

Use a native <button type="button"> for the placeholder. A <div> with a click handler can't be reached with Tab. If a page has several videos, a name like “Load ‘Workshop tour’ on YouTube” tells people which one will open. For a map, try “Load map to the workshop.” Keep the address and essential directions in the page text. If you provide a transcript, keep it accessible while the video is blocked.

Give the embedded content a descriptive title, such as title="YouTube video: Workshop tour" or title="Google Maps: Directions to the workshop". Add it to the iframe the page inserts after activation. If a plugin generates the embed, check the element it actually renders. W3C technique H64 for iframe titles

If you build your own placeholder, put the button in a container whose contents you can replace. Call this function once your site allows the embed to load. Keep the address or transcript outside that container.

function showVideo(slot, embedUrl) {
  const message = document.createElement("p");
  message.textContent = "Video loaded: Workshop tour";
  message.tabIndex = -1;

  const frame = document.createElement("iframe");
  frame.title = "YouTube video: Workshop tour";
  frame.src = embedUrl;
  // Copy other attributes, such as allow, from the provider's embed code.

  slot.replaceChildren(message, frame);
  message.focus();
}

Test the states on your site

Start with a fresh browser profile and go through the flow with a keyboard and screen reader. Record which embed and which version of your consent tool you tested.

In the real player, check that you can pause the video and switch captions on with a keyboard. On the map, try a control visitors need, such as zoom. Repeat the check after changes to the plugin or embed. W3C guide to media players · WCAG 2.2 on keyboard traps

What a scan finds in each state

On 18 November 2026, we tested both examples above with Chrome 153 and axe-core 4.12.1, using the rules for WCAG 2.0 to 2.2 at levels A and AA. We added a local test page with a hand-built placeholder that uses a <div> with a click handler instead of a button.

Before loading, axe-core reported nothing about the embed in any of the three cases. At that point there is no iframe whose name it could check. It also never reported the unreachable placeholder or the lost focus after Enter. You only find those by going through the flow with a keyboard yourself.

Check the scan report for which frames and page states it reached. Run it again with the embed blocked and loaded. Alongside those results, record what you can reach with Tab and how the screen reader identifies the embed.

Further reading and sources