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

Scroll with scrollbar on Big modal windows #43

Open
theposch opened this issue Jan 25, 2014 · 5 comments
Open

Scroll with scrollbar on Big modal windows #43

theposch opened this issue Jan 25, 2014 · 5 comments

Comments

@theposch
Copy link

Is it possible to scroll using the scrollbar on large modal windows? right now, clicking the scrollbar will close the modal.

@adamschwartz
Copy link
Contributor

Since the .vex element is set to overflow: auto in all included themes, there is a scrollbar present on that element.

Unfortunately, since the .vex-overlay element is behind .vex-content (but still a child of .vex) it catches clicks before they reach down to the scrollbar. So you have a few options to achieve what you want:

  • Leave the overlay there but set pointer-events: none so that the click event passes through to the scrollbar:

    .vex-overlay {
        pointer-events: none
    }
  • Hide the overlay entirely:

    .vex-overlay {
        display: none
    }
  • Move the right edge of the overlay over a bit so that the scrollbar can be seen below it.

    .vex-overlay {
        right: 16px /* Approximate scrollbar width */
    }

If you go with this last option I'd recommend setting the .vex-overlay's right CSS property only in the event you detect a scrollbar is present. You can do this using the technique outlined in my comment here.

@tvavrys
Copy link

tvavrys commented Apr 8, 2014

I ran into the same issue. None of the solutions you mentioned have worked for me. I consider them as workarounds. Do you plan to fix it and change the structure of elements?

@adamschwartz
Copy link
Contributor

@tvavrys thanks for the push.

I think the right call is to change the structure to something like this:

<div class="vex">
    <div class="vex-overlay"></div>
    <div class="vex-content-scroll">
        <div class="vex-content"></div>
    </div>
</div>

As this will be a breaking change, it will probably necessitate a major version bump.

In the meantime, the third solution above should work just fine, and in some ways, it may even be preferred. Would you mind giving it another shot and letting me know what seems to be failing?

@tvavrys
Copy link

tvavrys commented Apr 14, 2014

I remember that the third solution does not solve scrolling problem (middle button scrolling) when you have your mouse over vex-overlay.

The new structure should solve this problem, but I completely understand your concerns regarding the major version bump. It's not a small change.

@sebastianhelbig
Copy link

To have scrolling on the overlay and also be able to close the content with a click on the overlay:

.vex-overlay {
    pointer-events: none;
}
var vexContent = vex.open({...});
$('.vex').click(function() {
    vex.close(vexContent.data().vex.id);
});
$('.vex-content').click(function(event) {
    event.stopPropagation();
});

ghost pushed a commit to LibreOffice/online that referenced this issue Jun 22, 2016
HubSpot/vex#43

Change-Id: Id26be54a3a1120119bddad442e30b5f71f1e2605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants