-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(mui): remove nested interactive elements from button components #7094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(mui): remove nested interactive elements from button components #7094
Conversation
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
🦋 Changeset detectedLatest commit: a011a43 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for refine-doc-live-previews ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
alicanerdurmaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @ctonneslan, your PR is great, thank you. I also made a couple of changes:
- Refactored the link in the
<ThemedTitle />component using your method. - Updated the
@refinedev/inferencertests.
However, the button tests are still failing. Could you take a look at them?
Summary
Changes
componentproptextDecoration: "none"style to the Button's sx proponClickhandler to the Button componentContext
The previous implementation wrapped a
<Button>element inside a<LinkComponent>(anchor tag), creating nested interactive elements. This violates accessibility guidelines and causes issues:Solution
Material UI's Button component supports rendering as different components via the
componentprop. By passingcomponent={LinkComponent}, the Button renders directly as a link, maintaining all navigation functionality without the nested structure.Test Plan
Affected Components
Resolves #7085