Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Iframe: try role=application
  • Loading branch information
ellatrix committed Sep 8, 2023
commit e31831fe67472c6a0b7821d4c8d8c3de844a54fe
5 changes: 3 additions & 2 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
useMemo,
useEffect,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import {
useResizeObserver,
useMergeRefs,
Expand Down Expand Up @@ -234,6 +233,8 @@ function Iframe( {
return (
<>
{ tabIndex >= 0 && before }
{ /* No title to reduce screen reader verbosity. */ }
{ /* eslint-disable-next-line jsx-a11y/iframe-has-title */ }
<iframe
{ ...props }
style={ {
Expand All @@ -260,7 +261,7 @@ function Iframe( {
// mode. Also preload the styles to avoid a flash of unstyled
// content.
src={ src }
title={ __( 'Editor canvas' ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Turns out this is actually an accessibility violation. This isn't a rule I agree with considering the iFrame is wrapped in a role="region" with a valid aria-label.

@afercia You think this is something we can get away with given the situation?

Having a region labeled as Editor Content followed by the iFrame labeled as Editor Canvas is very verbose and not helpful. The other option, remove the aria-label from this region and the title should be good enough since it is the only element?

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/region_role

Regions seem to require accessible labels so really struggling here as to how labeling should:
A. Not be annoying.
B. Not be an accessibility violation from the lack of labeling.

role="application"
>
{ iframeDocument &&
createPortal(
Expand Down