-
-
Notifications
You must be signed in to change notification settings - Fork 593
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
Disabling the escape key handler #761
Comments
Hi @dennmat-hurdle, Did you find a solution ? I'm struggled with that behavior too |
I didn't find a workaround to fix this unfortunately. I ended up changing the behavior of the UI to accommodate this for now but with no reply on this I didn't want to go through making a PR that would likely just sit there as I don't want to fork this and have a version that is stale. I'm thinking this may be unmaintained at this point so down the line I'll be looking at finding one still in development. I don't have the time to take on maintaining this unfortunately, but I'd be glad to contribute if it were still maintained. There are 'hacky' solutions you could employ, like always setting clickToClose false and then using JS that watches for dom changes to find whenever a modal is open and then listen for click events yourself there while separately handling key listeners for escape but it's a bit hacky and adds a lot of mental overhead to the codebase for the return I think. So the preferable solution would be the smaller change to the library. |
Hi, Thanks for your response, Basically, you must :
After, like you say, the best is maybe to switch the library :/ |
Problem:
Looking for a way to be able to disable the escape key handler while maintaining the ability to click to close.
Right now it seems the only way to prevent the modal from listening for the escape key is by setting click to close to false.
I've got a system already in place I can leverage to handle closing the correct modal but I can't get around this listener currently without losing the click to close behavior.
Consider the case of multiple modals open. If you press escape to close the front most one it will close all of them, which I'd imagine isn't the behavior generally expected.
I'd be willing to make a change and pull request that would alter the behavior to this (if agreed upon):
escapeToClose
to keep the naming similar. It could default to the value of clickToClose which would mean the overall effect of the change would not be noticed end users. And they would instead need to specify escape to close to be false.I'd also be willing to take the time to implement a potentially better solution if someone more familiar with the code base has a better idea of how to tackle this. From a quick glance it seems like this could be built in to dynamic modals(where vue-js-modal could intelligently close the correct modal on escape) but would fall apart if mixed with static ones.
Let me know, also feel free to let me know if I've missed something glaringly obvious that would provide the behavior I'm looking for
The text was updated successfully, but these errors were encountered: