Skip to content

Components: Align disabled Button cursor with UX best practices#71321

Open
Akhilanandateja wants to merge 2 commits into
WordPress:trunkfrom
Akhilanandateja:fix/button-disabled-cursor-71316
Open

Components: Align disabled Button cursor with UX best practices#71321
Akhilanandateja wants to merge 2 commits into
WordPress:trunkfrom
Akhilanandateja:fix/button-disabled-cursor-71316

Conversation

@Akhilanandateja

Copy link
Copy Markdown

What?

Closes #71316

This pull request aligns the cursor style of disabled Button components with standard accessibility and user experience (UX) best practices by removing the interactive pointer cursor.

Why?

A fundamental principle of UI design is that an element's appearance should match its state. Currently, a disabled Button component still shows a pointer cursor on hover, which incorrectly signals that it can be clicked. This creates a minor but notable inconsistency in the user experience.

This change corrects that behavior, ensuring the button's appearance accurately reflects its non-interactive state.

How?

The fix is a single-line CSS addition. I've added cursor: default; to the base &:disabled, &[aria-disabled="true"] rule within packages/components/src/button/style.scss.

This ensures that all variants of the Button component inherit the correct non-interactive cursor style, which browsers typically render as a "not-allowed" symbol when an element is disabled.

Testing Instructions

Testing Environment Note: I encountered a persistent networking issue within my GitHub Codespace environment that prevented Storybook from rendering correctly (the server was sending the page as text/plain instead of text/html). As a result, I was unable to perform the final visual verification myself.

However, the change can be tested with the following steps:

  1. Run Storybook with npm run storybook:dev.

  2. Navigate to the Components > Button story.

  3. Use the "Controls" panel to toggle the isDisabled prop to true.

  4. Hover over any disabled button variant. The cursor should now be the default system cursor (or a "not-allowed" symbol), not a pointer/hand.

  5. The project's linting checks (npm run lint) pass successfully.

Testing Instructions for Keyboard

As disabled buttons cannot be focused via standard keyboard navigation, there are no specific keyboard testing instructions for this change.

A disabled button should not appear clickable. This sets the cursor to 'default' for the disabled state. Fixes WordPress#71316
@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin, New Block.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions

github-actions Bot commented Aug 23, 2025

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @Akhilanandateja, @RohithMacharla11, @ktmn.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: Akhilanandateja, RohithMacharla11, ktmn.

Co-authored-by: aduth <aduth@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Aug 23, 2025
@github-actions

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Akhilanandateja! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@Akhilanandateja

Copy link
Copy Markdown
Author

Just to clarify for the reviewers, this PR is focused specifically on fixing the cursor for the disabled state of the Button component, which is a clear-cut UX improvement. This is separate from the larger discussion in #71316 about when enabled buttons should use a pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Components: Remove pointer styling from Button component

1 participant