Closed clarkey closed 7 years ago
Yes! There are two options that you can pass to vex.open
to achieve the behavior you described:
escapeButtonCloses
to false
to prevent the vex from closing on ESCoverlayClosesOnClick
to false
to prevent the vex from closing from a click outside the dialogHere is a link to the relevant documentation: http://github.hubspot.com/vex/api/advanced/#options
@bbatliner thanks!
Found this issue while trying to keep the vex dialog from closing if I dragged my mouse from the dialog to outside of it and let go (fired a 'click'). There's a few situations that caused this to occur.. so I've changed it to only close the vex instance with a mousedown instead of click. Didn't want to disable with overlayClosesOnClick
, just change to a mousedown
instead. Might be useful to others out there:
In vex.combined.min.js
, replaced the following: g.overlayClosesOnClick&&y.addEventListener("click"
with
g.overlayClosesOnClick&&y.addEventListener("mousedown"
Incase this causes any other weird issues.. like scrolling window for a very long vex message, I use the unsafeMessage
attribute with a div with the folllowing class vex-long
, which is defined as such:
.vex-long{
width:100%;
height:50vh;
border-bottom:1px solid #aaa;
max-height:70vh;
overflow-y:auto;
padding-bottom:10px;
font-size:10pt;
background:none;
padding:5px;
box-sizing: border-box;
outline:none;
}
Is it possible to prevent vex from closing by hitting ESC or clicking outside the dialog?