Skip to content

Commit 097de0a

Browse files
committed
fix: QPopover hide condition in reposition (quasarframework#2045)
1 parent 127702b commit 097de0a

File tree

3 files changed

+80
-12
lines changed

3 files changed

+80
-12
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<div class="row" style="padding: 1500px 0">
3+
<div class="col" style="height:2000px; width:100px; background-color:red;">
4+
<q-context-menu>
5+
<q-list link separator style="min-width: 150px; max-height: 300px;">
6+
<q-item v-close-overlay>
7+
<q-item-main label="Test" />
8+
</q-item>
9+
</q-list>
10+
</q-context-menu>
11+
</div>
12+
13+
<div class="col" style="margin-top: 500px; height:2000px; width:100px; background-color:red;">
14+
<q-context-menu>
15+
<q-list link separator style="min-width: 150px; max-height: 300px;">
16+
<q-item v-close-overlay>
17+
<q-item-main label="Test" />
18+
</q-item>
19+
</q-list>
20+
</q-context-menu>
21+
</div>
22+
23+
<div class="col" style="margin-bottom: 500px; height:2000px; width:100px; background-color:red;">
24+
<q-context-menu>
25+
<q-list link separator style="min-width: 150px; max-height: 300px;">
26+
<q-item v-close-overlay>
27+
<q-item-main label="Test" />
28+
</q-item>
29+
</q-list>
30+
</q-context-menu>
31+
</div>
32+
</div>
33+
</template>
34+
35+
<script>
36+
export default {
37+
data () {
38+
return {
39+
}
40+
},
41+
methods: {
42+
}
43+
}
44+
</script>
45+
46+
<style lang="stylus">
47+
@import '~variables'
48+
49+
</style>

dev/components/web-tests/fast-test.vue

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
<template>
2-
<div class="layout-padding">
3-
<!--
4-
This is for fast tests.
5-
Use this page but don't add it into your commits (leave it outside
6-
of your commit).
2+
<div class="row" style="padding: 1500px 0">
3+
<div class="col" style="height:2000px; width:100px; background-color:red;">
4+
<q-context-menu>
5+
<q-list link separator style="min-width: 150px; max-height: 300px;">
6+
<q-item v-close-overlay>
7+
<q-item-main label="Test" />
8+
</q-item>
9+
</q-list>
10+
</q-context-menu>
11+
</div>
12+
13+
<div class="col" style="margin-top: 500px; height:2000px; width:100px; background-color:red;">
14+
<q-context-menu>
15+
<q-list link separator style="min-width: 150px; max-height: 300px;">
16+
<q-item v-close-overlay>
17+
<q-item-main label="Test" />
18+
</q-item>
19+
</q-list>
20+
</q-context-menu>
21+
</div>
722

8-
For some test that you think it should be persistent,
9-
make a new *.vue file here or in another folder under /dev/components.
10-
-->
23+
<div class="col" style="margin-bottom: 500px; height:2000px; width:100px; background-color:red;">
24+
<q-context-menu>
25+
<q-list link separator style="min-width: 150px; max-height: 300px;">
26+
<q-item v-close-overlay>
27+
<q-item-main label="Test" />
28+
</q-item>
29+
</q-list>
30+
</q-context-menu>
1131
</div>
32+
</div>
1233
</template>
1334

1435
<script>

src/components/popover/QPopover.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,9 @@ export default {
129129
if (this.fit) {
130130
this.$el.style.minWidth = width(this.anchorEl) + 'px'
131131
}
132-
const
133-
{ top, bottom } = this.anchorEl.getBoundingClientRect(),
134-
{ height } = window.innerHeight
132+
const { top, bottom } = this.anchorEl.getBoundingClientRect()
135133

136-
if (bottom < 0 || top > height) {
134+
if (bottom < 0 || top > window.innerHeight) {
137135
return this.hide()
138136
}
139137

0 commit comments

Comments
 (0)