Skip to content
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

[material-ui][Button] Apply id only if loading indicator is present #45296

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aarongarciah
Copy link
Member

@aarongarciah aarongarciah commented Feb 13, 2025

We introduced an id attribute in all buttons when we introduced the loading prop in the Button component (#44637). We've got a couple of reports that some tests were broken because of this: #44637 (comment)

This PR changes the logic so the id attribute is only added when the loading indicator is present.

@aarongarciah aarongarciah added component: button This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Feb 13, 2025
@aarongarciah aarongarciah changed the title Apply id only if loading indicator is present [material-ui][Button] Apply id only if loading indicator is present Feb 13, 2025
@mui-bot
Copy link

mui-bot commented Feb 13, 2025

Netlify deploy preview

https://deploy-preview-45296--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 34e25af

@aarongarciah aarongarciah marked this pull request as ready for review February 13, 2025 08:43
@aarongarciah aarongarciah mentioned this pull request Feb 13, 2025
1 task
@aarongarciah aarongarciah added the on hold There is a blocker, we need to wait label Feb 13, 2025
@aarongarciah aarongarciah removed the request for review from DiegoAndai February 13, 2025 08:52
@aarongarciah aarongarciah marked this pull request as draft February 13, 2025 08:52
const loader =
typeof loading === 'boolean' ? (
let loader = null;
let computedId = idProp;
Copy link
Member Author

@aarongarciah aarongarciah Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's no loading present, we just use the id prop. loadingId always has a value (idProp or generated using useId)

@aarongarciah aarongarciah force-pushed the button-conditional-loading-id branch from 7c4d446 to 34e25af Compare February 13, 2025 09:40
@aarongarciah aarongarciah marked this pull request as ready for review February 13, 2025 09:59
@aarongarciah aarongarciah removed the on hold There is a blocker, we need to wait label Feb 13, 2025
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, but I would like to have @siriwatknp's review next week, as he is more familiarized with potential edge cases.

Should we cherry-pick this to v6?

@aarongarciah aarongarciah added the cherry-pick The PR was cherry-picked from the newer alpha/beta/stable branch label Feb 13, 2025
@aarongarciah
Copy link
Member Author

@DiegoAndai I just added the cherry-pick label

@DiegoAndai DiegoAndai added v6.x needs cherry-pick The PR should be cherry-picked to master after merge and removed cherry-pick The PR was cherry-picked from the newer alpha/beta/stable branch labels Feb 13, 2025
@DiegoAndai
Copy link
Member

@aarongarciah the "cherry-pick" one is for PRs that are cherry-picked. I updated the labels 😊.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module! needs cherry-pick The PR should be cherry-picked to master after merge package: material-ui Specific to @mui/material v6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants