Skip to content

Commit facad84

Browse files
committed
Merge branch 'patch-6' of https://github.com/mesqueeb/vue-final-modal into bugfix/do-not-close-modal-when-select-text
2 parents c848a8a + 090d854 commit facad84

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

dist/VueFinalModal.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/VueFinalModal.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@
4040
role="dialog"
4141
aria-modal="true"
4242
tabindex="-1"
43-
@click.self="onClickContainer"
43+
@mouseup.self.stop="onMouseupContainer"
44+
@touchend.self.stop="onMouseupContainer"
45+
@mousedown.self.stop="onMousedown"
46+
@touchstart.self.stop="onMousedown"
4447
>
4548
<div
4649
ref="vfmContent"
4750
class="vfm__content"
4851
:class="[contentClass, { 'vfm--prevent-auto': preventClick }]"
4952
:style="bindContentStyle"
53+
@mousedown.self.stop="onMousedown"
54+
@touchstart.self.stop="onMousedown"
5055
>
5156
<slot :params="params" :close="() => $emit('input', false)" />
5257
<div
@@ -178,7 +183,8 @@ export default {
178183
dragResizeStyle: {},
179184
resolveToggle: noop,
180185
rejectToggle: noop,
181-
state: null
186+
state: null,
187+
lastMousedownEl: null
182188
}),
183189
computed: {
184190
api() {
@@ -430,7 +436,12 @@ export default {
430436
if (stopEvent) return
431437
this.params = {}
432438
},
433-
onClickContainer() {
439+
onMousedown(e) {
440+
this.lastMousedownEl = e.target
441+
},
442+
onMouseupContainer(e) {
443+
// skip when the mousedown didn't start on the container el
444+
if (this.lastMousedownEl !== e.target) return
434445
// skip when state equal 'resize:move'
435446
if (this.state === 'resize:move') return
436447
this.$emit('click-outside', this.createModalEvent({ type: 'click-outside' }))

0 commit comments

Comments
 (0)