Skip to content

Commit

Permalink
ToolbarButton: Fix docs for accessibleWhenDisabled (WordPress#63140)
Browse files Browse the repository at this point in the history
Co-authored-by: mirka <[email protected]>
Co-authored-by: DaniGuardiola <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
4 people authored Jul 5, 2024
1 parent 885dd36 commit 88f44fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/toolbar/toolbar-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Button from '../../button';
import ToolbarItem from '../toolbar-item';
import ToolbarContext from '../toolbar-context';
import ToolbarButtonContainer from './toolbar-button-container';
import type { ToolbarButtonDeprecatedProps, ToolbarButtonProps } from './types';
import type { ToolbarButtonOverriddenProps, ToolbarButtonProps } from './types';
import type { WordPressComponentProps } from '../../context';

function useDeprecatedProps( {
Expand All @@ -32,9 +32,9 @@ function useDeprecatedProps( {
function UnforwardedToolbarButton(
props: Omit<
WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,
'__experimentalIsFocusable' // ToolbarButton will always be focusable even when disabled.
'accessibleWhenDisabled' // By default, ToolbarButton will be focusable when disabled.
> &
ToolbarButtonDeprecatedProps,
ToolbarButtonOverriddenProps,
ref: ForwardedRef< any >
) {
const {
Expand Down
14 changes: 10 additions & 4 deletions packages/components/src/toolbar/toolbar-button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ export type ToolbarButtonProps = {
title?: string;
};

export type ToolbarButtonDeprecatedProps = {
export type ToolbarButtonOverriddenProps = {
/**
* Whether to keep the button focusable when disabled.
*
* @deprecated ToolbarButton will always be focusable even when disabled.
* @ignore
* In most cases, it is recommended to set this to `true`. Disabling a control without maintaining focusability
* can cause accessibility issues, by hiding their presence from screen reader users,
* or by preventing focus from returning to a trigger element.
*
* Learn more about the [focusability of disabled controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols)
* in the WAI-ARIA Authoring Practices Guide.
*
* @default true
*/
__experimentalIsFocusable?: boolean;
accessibleWhenDisabled?: boolean;
};

export type ToolbarButtonContainerProps = {
Expand Down

0 comments on commit 88f44fd

Please sign in to comment.