-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[joy-ui][Button] Disable text highlighting #41902
Conversation
Netlify deploy previewhttps://deploy-preview-41902--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
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.
@mithun522 Thanks for the pull request to fix it. If you check Material UI's loading button it adds userSelect: none
to the base button.
Additionally, text can still be highlighted when the Joy UI button is disabled, as seen in this example: https://deploy-preview-41902--material-ui.netlify.app/joy-ui/react-button/#basics.
So it's better to add the style unconditionally:
--- a/packages/mui-joy/src/Button/Button.tsx
+++ b/packages/mui-joy/src/Button/Button.tsx
@@ -139,6 +139,7 @@ export const getButtonStyles = ({
border: 'none',
backgroundColor: 'transparent',
cursor: 'pointer',
+ userSelect: 'none',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
@ZeeshanTamboli Thanks for your suggestion. I have made the change and gave a commit. Thank you again. |
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.
Thanks.
Fixes #41899 Where the user can see the text of the button by highlighting it.
Added userSelect: 'none', to the buttonClasses.loading which doesn't allow the users to select the button while it is loading(edited)Edited by ZeeshanTamboli: Add
userSelect: none
unconditionally to disable text highlighting (for both loading and disabled states).Preview: https://deploy-preview-41902--material-ui.netlify.app/joy-ui/react-button/