-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Stepper] Add componentsProps.label to StepLabel #26304
Comments
Another possible solution to my direct problem is to have already that |
I just tried using Apple's screen reader, VoiceOver, for the first time. I just realized that it reads the current step only if I place I still believe that we should add I suggested adding |
This looks close to #19696 (comment) |
Yeah, I do see the similarities, @oliviertassinari. I'll write up a PR similar to #25883 but for the |
A couple of thoughts:
diff --git a/packages/material-ui/src/StepLabel/StepLabel.js b/packages/material-ui/src/StepLabel/StepLabel.js
index b2749f1671..414ba72ebe 100644
--- a/packages/material-ui/src/StepLabel/StepLabel.js
+++ b/packages/material-ui/src/StepLabel/StepLabel.js
@@ -4,7 +4,6 @@ import clsx from 'clsx';
import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled';
import experimentalStyled from '../styles/experimentalStyled';
import useThemeProps from '../styles/useThemeProps';
-import Typography from '../Typography';
import StepIcon from '../StepIcon';
import StepperContext from '../Stepper/StepperContext';
import StepContext from '../Step/StepContext';
@@ -64,11 +63,13 @@ const StepLabelRoot = experimentalStyled('span', {
}),
}));
-const StepLabelLabel = experimentalStyled(Typography, {
+const StepLabelLabel = experimentalStyled('span', {
name: 'MuiStepLabel',
slot: 'Label',
overridesResolver: (props, styles) => styles.label,
})(({ theme }) => ({
+ ...theme.typography.body2,
+ display: 'block',
/* Styles applied to the Typography component that wraps `children`. */
transition: theme.transitions.create('color', {
duration: theme.transitions.duration.shortest,
@@ -170,9 +171,6 @@ const StepLabel = React.forwardRef(function StepLabel(inProps, ref) {
<StepLabelLabelContainer className={classes.labelContainer} styleProps={styleProps}>
{children ? (
<StepLabelLabel
- variant="body2"
- component="span"
- display="block"
className={classes.label}
styleProps={styleProps}
> |
Summary 💡
I want to add a
TypographyProps
argument toStepLabelProps
in the same vein asStepIconProps
.Examples 🌈
How I currently code
How I wish to code
Motivation 🔦
I want to add an ARIA property to the span that wraps the label, but I currently can't. My current solution is to place a
span
inside theStepLabel
, but it just adds an unnecessary DOM element.The text was updated successfully, but these errors were encountered: