Fixed issue with MediaModal causing page to scroll to top on open
• Fixed: - issue with MediaModal causing page to scroll to top on open The code in this removal was used to enable a back-btn to close the media modal. But unintended scrolling is more important than a third option to close a dialog. (Click X, press escape)
This commit is contained in:
parent
444263a8b2
commit
573fdbc981
@ -67,28 +67,10 @@ class MediaModal extends ImmutablePureComponent {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
window.addEventListener('keydown', this.handleKeyDown, false)
|
window.addEventListener('keydown', this.handleKeyDown, false)
|
||||||
|
|
||||||
if (this.context.router) {
|
|
||||||
const history = this.context.router.history
|
|
||||||
|
|
||||||
history.push(history.location.pathname, previewState)
|
|
||||||
|
|
||||||
this.unlistenHistory = history.listen(() => {
|
|
||||||
this.props.onClose()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.removeEventListener('keydown', this.handleKeyDown)
|
window.removeEventListener('keydown', this.handleKeyDown)
|
||||||
|
|
||||||
if (this.context.router) {
|
|
||||||
this.unlistenHistory()
|
|
||||||
|
|
||||||
if (this.context.router.history.location.state === previewState) {
|
|
||||||
this.context.router.history.goBack()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getIndex() {
|
getIndex() {
|
||||||
|
Loading…
Reference in New Issue
Block a user