Skip to content

Conversation

@ctonneslan
Copy link

Summary

  • Fixed accessibility issue in Material UI button components
  • Removed nested button-inside-anchor structure
  • Updated 5 button components: CreateButton, EditButton, CloneButton, ListButton, ShowButton

Changes

  • Modified button components to use Material UI's Button component prop
  • Button now renders directly as a link instead of being nested inside an anchor
  • Moved textDecoration: "none" style to the Button's sx prop
  • Moved onClick handler to the Button component

Context

The previous implementation wrapped a <Button> element inside a <LinkComponent> (anchor tag), creating nested interactive elements. This violates accessibility guidelines and causes issues:

  • Keyboard navigation focuses the element twice (once for anchor, once for button)
  • Screen readers may announce the element incorrectly
  • Violates WCAG guidelines for interactive element nesting

Solution

Material UI's Button component supports rendering as different components via the component prop. By passing component={LinkComponent}, the Button renders directly as a link, maintaining all navigation functionality without the nested structure.

Test Plan

  • Verify buttons still navigate correctly when clicked
  • Test keyboard navigation - buttons should only be focused once
  • Verify disabled state still prevents navigation
  • Test custom onClick handlers still work properly
  • Check that all 5 button types work correctly

Affected Components

  • CreateButton
  • EditButton
  • CloneButton
  • ListButton
  • ShowButton

Resolves #7085

Fixed accessibility issue where button components rendered a button inside an anchor. This caused keyboard navigation issues and violated accessibility guidelines.

Updated CreateButton, EditButton, CloneButton, ListButton, and ShowButton to use MUI Button component prop instead of nesting elements.

Resolves refinedev#7085
@ctonneslan ctonneslan requested a review from a team as a code owner October 27, 2025 13:48
@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2025

🦋 Changeset detected

Latest commit: ce93d96

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/mui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for refine-doc-live-previews ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ce93d96
🔍 Latest deploy log https://app.netlify.com/projects/refine-doc-live-previews/deploys/6909b2205cf8d30008a9b854
😎 Deploy Preview https://deploy-preview-7094--refine-doc-live-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CreateButton of Material UI integration renders button in anchor

2 participants