-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Disabled blocks: identify alternatives to "inert" #54369
Copy link
Copy link
Open
Labels
Needs Accessibility FeedbackNeed input from accessibilityNeed input from accessibilityNeeds DecisionNeeds a decision to be actionable or relevantNeeds a decision to be actionable or relevant[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components/packages/components[Type] DiscussionFor issues that are high-level and not yet ready to implement.For issues that are high-level and not yet ready to implement.[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Metadata
Metadata
Assignees
Labels
Needs Accessibility FeedbackNeed input from accessibilityNeed input from accessibilityNeeds DecisionNeeds a decision to be actionable or relevantNeeds a decision to be actionable or relevant[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components/packages/components[Type] DiscussionFor issues that are high-level and not yet ready to implement.For issues that are high-level and not yet ready to implement.[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Gutenberg's use of "inert"
Gutenberg uses the inert HTML attribute to disable blocks in the editor.
For instance, in the useDisabled hook and on template parts when editing a page in the Site Editor (via useBlockProps).
The assumption is that Gutenberg should have a good reason to disable blocks.
The use of "inert" on disabled blocks impacts accessibility by hiding them from the accessibility tree. In cases where disabled content conveys information in some way, or has, albeit, limited interaction, screen readers/keyboard users have no knowledge of its purpose or existence.
The argument for using "inert" in the editor is that disabled blocks are, as far as the browser and user are concerned, functionally "hidden". They are unfocusable and non-interactive and therefore serve no purpose other than placeholders.
Could the editor communicate this intention in another way while retaining "inert"? For example a label that describes the disabled state and what is being disabled?
Related discussions:
Alternatives
I'm not proposing any specific approach, just trying to collate and summarize various discussions.
A proposed approach would be to create a general callback to prevent default behaviour via event handlers, potentially via event delegation/capturing on the editor container. For example,
click,focus,keyDown,changeetc.To disable interaction for all core blocks while maintaining keyboard navigation would be challenging. Each core block is unique. Take for example the search block, which contains several focusable elements including a input field and a rich text component.
More time consuming, each block could handle its own disabled state separately. So, the idea is that a block would receive a prop to inform it that it has been "disabled" in the editor and it would render itself accordingly. Perhaps something similar to how the ally library disables elements.
Here's an example of a PR that attempts to accomplish this for the table block:
Questions
Related reading