simplify back and just use css class

This commit is contained in:
Artur Paikin 2018-01-29 14:18:16 -05:00
parent 465bf77750
commit daeea9d7fa
3 changed files with 10 additions and 26 deletions

View file

@ -201,20 +201,6 @@ module.exports = class Dashboard extends Plugin {
}
}
scrollBehaviour (toggle) {
if (!this.opts.disablePageScrollWhenModalOpen) return
const body = document.querySelector('body')
switch (toggle) {
case 'enable':
Object.assign(body.style, { overflow: 'initial', height: 'initial' })
break
case 'disable':
Object.assign(body.style, { overflow: 'hidden', height: '100vh' })
break
default:
}
}
openModal () {
this.setPluginState({
isHidden: false
@ -225,12 +211,10 @@ module.exports = class Dashboard extends Plugin {
// save active element, so we can restore focus when modal is closed
this.savedActiveElement = document.activeElement
// add class to body that sets position fixed, move everything back
// to scroll position
// document.body.classList.add('uppy-Dashboard-isOpen')
// document.body.style.top = `-${this.savedScrollPosition}px`
if (!this.opts.disablePageScrollWhenModalOpen) {
document.body.classList.remove('uppy-Dashboard-isOpen')
}
this.scrollBehaviour('disable')
this.updateDashboardElWidth()
this.setFocusToFirstNode()
}
@ -240,10 +224,11 @@ module.exports = class Dashboard extends Plugin {
isHidden: true
})
// document.body.classList.remove('uppy-Dashboard-isOpen')
this.scrollBehaviour('enable')
if (!this.opts.disablePageScrollWhenModalOpen) {
document.body.classList.remove('uppy-Dashboard-isOpen')
}
this.savedActiveElement.focus()
// window.scrollTo(0, this.savedScrollPosition)
}
isModalOpen () {

View file

@ -9,9 +9,8 @@
// Added to body to prevent the page from scrolling when Modal is open
.uppy-Dashboard-isOpen {
width: 100%;
overflow: hidden;
position: fixed;
height: 100vh;
}
.uppy-Dashboard--modal .uppy-Dashboard-overlay {

View file

@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"hexo": {
"version": "3.3.7"
"version": "3.5.0"
},
"dependencies": {
"autoprefixer": "^7.2.5",
@ -42,4 +42,4 @@
"remark": "5.0.1",
"watchify": "^3.9.0"
}
}
}