Skip to content

Commit

Permalink
[docs] Fix modal demo jumping on cursor move (#15462)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Apr 23, 2019
1 parent 07e3412 commit 6bff226
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/src/pages/utils/modal/SimpleModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const useStyles = makeStyles(theme => ({

function SimpleModal() {
const [open, setOpen] = React.useState(false);
// getModalStyle is not a pure function, we roll the style only on the first render
const [modalStyle] = React.useState(getModalStyle);

const handleOpen = () => {
setOpen(true);
Expand All @@ -52,7 +54,7 @@ function SimpleModal() {
open={open}
onClose={handleClose}
>
<div style={getModalStyle()} className={classes.paper}>
<div style={modalStyle} className={classes.paper}>
<Typography variant="h6" id="modal-title">
Text in a modal
</Typography>
Expand Down

0 comments on commit 6bff226

Please sign in to comment.