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

Key-event "esc" without focus on modal #25

Open
claudio147 opened this issue May 24, 2018 · 2 comments
Open

Key-event "esc" without focus on modal #25

claudio147 opened this issue May 24, 2018 · 2 comments

Comments

@claudio147
Copy link

Is there a reason why the key-event for "escape" just works if the user first clicks inside the modal? I think it would be better if you have a global key event listener which closes you the latest modal.

Something like:

mounted() {
      VuedalsBus.$on('opened', (modal) => {
        if (modal.options.escapable) {
          document.addEventListener('keydown', function dismissModal(event) {
            if (event.keyCode === 27) {
              VuedalsBus.$emit('close');
              document.removeEventListener('keydown', dismissModal, true);
            }
          }, true);
        }
      });
    },
@javisperez
Copy link
Owner

Oh you're right, I'll have a look and fix this as soon as i can. Also, if you are able to fix it, would really appreciate a PR. Thanks for the issue.

@Ishodnikov
Copy link
Contributor

Don't fixed?

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

3 participants