Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make the modal overflow on vfm--fixed element correctly? #337

Open
johnson0903 opened this issue Mar 2, 2023 · 8 comments
Open
Assignees
Labels
question Further information is requested

Comments

@johnson0903
Copy link

johnson0903 commented Mar 2, 2023

Version

vue-final-modal: 4.0.7
vue: 3.2.37

Reproduction Link

https://codesandbox.io/p/sandbox/vue-final-modal-scroll-9vkef0

What is Expected?

I want to make the modal content scrollable and the scrollbar should appear on vfm--fixed element, such as Bootstrap Scrolling long content Modal Example.

What is actually happening?

I add overflow-y: auto on vfm--fixed element to make the scrollbar appear on the right side , but it caused 2 problems.
First, the overlay height is not equal to the long content. Maybe can make it appear outside the vfm container to solve this problem.

Second, when release the mouse after drag or click on the scroll bar, the modal was closed.

Any suggestion will be helpful !

@johnson0903 johnson0903 added the question Further information is requested label Mar 2, 2023
@hunterliu1003
Copy link
Member

@johnson0903

I implemented an long content scroll modal example like bootstrap:
https://codesandbox.io/p/sandbox/vue-final-modal-scroll-forked-totdfc

@johnson0903
Copy link
Author

@johnson0903

I implemented an long content scroll modal example like bootstrap: https://codesandbox.io/p/sandbox/vue-final-modal-scroll-forked-totdfc

Thank you! Would you add this example to the documentaion?

@hunterliu1003
Copy link
Member

Yeah I'll consider to add a new use case inside of https://vue-final-modal.org/use-cases/playground/.

@hunterliu1003
Copy link
Member

The example was added to the use-cases page:
https://vue-final-modal.org/use-cases/modal-long-scroll

@johnson0903
Copy link
Author

Hi Hunter,

Thank you for your previous update. I have another question related to user experience.

I noticed that in the example you updated, if the mouse is clicked inside the modal and then dragged to the gray background before being released, the modal will be closed.

However, it seems that the original VueFinalModal component handles this issue to prevent the modal from being closed. Is there a way to avoid this situation in this example as well?

chrome_FELgXA4nT9

@hunterliu1003
Copy link
Member

@johnson0903 Thanks for your feedback.
Here is the issue: #352

@hunterliu1003
Copy link
Member

@johnson0903 The issue was fixed in version v4.1.3

@johnson0903
Copy link
Author

johnson0903 commented Apr 6, 2023

@hunterliu1003
Thank you for fixing the issue of the screen jumping when opening the modal.
However, the question I originally wanted to ask was how to prevent the modal from closing when I drag the mouse from inside the modal to outside and release the mouse, which only happens in the Modal Long Scroll example. Currently it still happen in the example.

I am wondering if it's because the click.self directive written in the following code block of the example is causing the issue:
<div class="absolute inset-0 h-full overflow-auto" @click.self="() => emit('update:modelValue', false)">
In the Modal Long Scroll example, this directive is used to listen for clicks outside of the modal.
chrome_sxAWv0kABf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants