Skip to content

Fix click management when navigation selector is busy #43901

Description

@draganescu

[We can] use disabled, but __experimentalIsFocusable needs to be specified to make the Button component output aria-disabled instead of the normal disabled attribute and remain focused.

isBusy can be used to show a loading indicator, but it depends on whether that fits the design. Here's some pseudocode:

<Button isBusy={ isCreatingMenu } disabled={ isCreatingMenu } __experimentalIsFocusable>Create menu</Button>

edit: Button does also implicitly prevent clicks when configured this way:

if ( disabled && isFocusable ) {
// In this case, the button will be disabled, but still focusable and
// perceivable by screen reader users.
tagProps[ 'aria-disabled' ] = true;
for ( const disabledEvent of disabledEventsOnDisabledButton ) {
additionalProps[ disabledEvent ] = ( event ) => {
event.stopPropagation();
event.preventDefault();
};
}
}

Originally posted by @talldan in #42987 (comment)

Metadata

Metadata

Assignees

Labels

[Block] NavigationAffects the Navigation Block[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions