Skip to content

Commit

Permalink
fix(v-dialog): always remove scrollbar when fullscreen
Browse files Browse the repository at this point in the history
fixes #3101
  • Loading branch information
johnleider committed Oct 9, 2018
1 parent 5cfaeba commit ff5d07b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/VDialog/VDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export default {
this.removeOverlay()
this.unbind()
}
},
fullscreen (val) {
if (val) this.hideScroll()
else this.showScroll()
}
},

Expand Down Expand Up @@ -141,6 +145,13 @@ export default {
// Since this should only be called in a capture event (bottom up), we shouldn't need to stop propagation
return getZIndex(this.$refs.content) >= this.getMaxZIndex()
},
hideScroll () {
if (this.fullscreen) {
document.documentElement.classList.add('overflow-y-hidden')
} else {
Overlayable.methods.hideScroll.call(this)
}
},
show () {
!this.fullscreen && !this.hideOverlay && this.genOverlay()
this.fullscreen && this.hideScroll()
Expand Down
19 changes: 19 additions & 0 deletions test/unit/components/VDialog/VDialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,23 @@ test('VDialog.js', ({ mount, compileToFunctions }) => {

expect('Unable to locate target [data-app]').toHaveBeenTipped()
})

// https://github.com/vuetifyjs/vuetify/issues/3101
it('should always remove scrollbar when fullscreen', async () => {
const wrapper = mount(VDialog)

wrapper.setProps({ value: true })

await wrapper.vm.$nextTick()

expect(document.documentElement.className).not.toContain('overflow-y-hidden')

wrapper.setProps({ fullscreen: true })

await wrapper.vm.$nextTick()

expect(document.documentElement.className).toContain('overflow-y-hidden')

expect('Unable to locate target [data-app]').toHaveBeenTipped()
})
})

0 comments on commit ff5d07b

Please sign in to comment.