davidtheclark / react-aria-modal

A fully accessible React modal built according WAI-ARIA Authoring Practices
http://davidtheclark.github.io/react-aria-modal/demo/
MIT License
1.03k stars 96 forks source link

Allow dynamic updates for scrollDisabled #57

Closed dallonf closed 6 years ago

dallonf commented 6 years ago

I noticed that the component does not react if you change scrollDisabled while the modal is open (example use case: I have an exit animation for the modal, so it doesn't unmount right away, but would like to allow the user to start scrolling as soon as they've clicked to dismiss the modal).

So I fixed it :)

I also moved the noScroll.on() call to componentDidMount from componentWillMount(); rumor has it that dong any sorts of side effects in componentWillMount() will be aggressively deprecated soon. It also seemed to fix a bug I've observed in my implementation where if you close a modal and open a new one right away, noScroll would be deactivated.

davidtheclark commented 6 years ago

@dallonf Thanks! Looks great. And all your explanations make sense to me 👍