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

Enter key submit on confirms #289

Open
turtle0x1 opened this issue Nov 17, 2020 · 1 comment
Open

Enter key submit on confirms #289

turtle0x1 opened this issue Nov 17, 2020 · 1 comment

Comments

@turtle0x1
Copy link
Owner

turtle0x1 commented Nov 17, 2020

as pointed out by @abelgomez the $.confirm instances don't dismiss on escape key or submit on enter,

note to self;

fix escape key each confirm should look like $.confirm({backgroundDismiss: true, ...})

fix enter key

Slightly more involved, will have to wrap content in a <form> and then add event listener to onContentReady

$.confirm({
        ...
        content: `<form>
             ...
        </form>`
        ...
        buttons: {
           doSomething: {
              ...
              keys: ['enter'],
              ...
           }
        },
        onContentReady: function () {
            // bind to events
            var jc = this;
            this.$content.find('form').on('submit', function (e) {
                // if the user submits the form by pressing enter in the field.
                e.preventDefault();
                jc.$$BUTTON NAME HERE.trigger('click'); // reference the button and click it
            });
        }
});
@turtle0x1 turtle0x1 added this to the 0.11.0 milestone Nov 28, 2020
@turtle0x1
Copy link
Owner Author

The problem with this is that it requires adding additional code to block pressing escape once the user has clicked the button - this isn't a find and replace job so it becomes quite a big time investment.

Going to leave it open for the time being and move off 0.11.0

@turtle0x1 turtle0x1 modified the milestones: 0.11.0, Later Dec 28, 2020
@turtle0x1 turtle0x1 modified the milestones: Later, 0.13.0 Mar 28, 2021
@turtle0x1 turtle0x1 modified the milestones: 0.13.0, 0.15.0 Jun 23, 2021
@turtle0x1 turtle0x1 modified the milestones: 0.15.0, Later May 10, 2022
@turtle0x1 turtle0x1 changed the title Escape key dismiss & enter key submit on confirms Enter key submit on confirms Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant