import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Accordion from '@material-ui/core/Accordion';
import AccordionSummary from '@material-ui/core/AccordionSummary';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import Checkbox from '@material-ui/core/Checkbox';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Typography from '@material-ui/core/Typography';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
const useStyles = makeStyles({
root: {
width: '100%',
},
});
export default function ActionsInAccordionSummary() {
const classes = useStyles();
return (
}
aria-label="Expand"
aria-controls="additional-actions1-content"
id="additional-actions1-header"
>
event.stopPropagation()}
onFocus={(event) => event.stopPropagation()}
control={}
label="I acknowledge that I should stop the click event propagation"
/>
The click event of the nested action will propagate up and expand the accordion unless
you explicitly stop it.
}
aria-label="Expand"
aria-controls="additional-actions2-content"
id="additional-actions2-header"
>
event.stopPropagation()}
onFocus={(event) => event.stopPropagation()}
control={}
label="I acknowledge that I should stop the focus event propagation"
/>
The focus event of the nested action will propagate up and also focus the accordion
unless you explicitly stop it.
}
aria-label="Expand"
aria-controls="additional-actions3-content"
id="additional-actions3-header"
>
event.stopPropagation()}
onFocus={(event) => event.stopPropagation()}
control={}
label="I acknowledge that I should provide an aria-label on each action that I add"
/>
If you forget to put an aria-label on the nested action, the label of the action will
also be included in the label of the parent button that controls the accordion
expansion.
);
}