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

Pressing escape when escapeKey is bound to a disabled button closes the dialog #584

Open
jjbutera opened this issue Nov 8, 2023 · 1 comment

Comments

@jjbutera
Copy link

jjbutera commented Nov 8, 2023

jquery-confirm version:
v3.3.2

I'm submitting a ... (check one with "x")
[X ] bug report
[ ] feature request
[ ] support request

Current behavior:
When escapeKey is bound to a button, pressing escape closes the dialog when the button is disabled

Expected behavior:
The escape key should do nothing if the button to which it's bound is disabled.

@jjbutera
Copy link
Author

jjbutera commented Nov 8, 2023

This seems pretty easy to implement in the escape key code by simply checking the disabled property
if (!this['$_' + buttonKey].prop('disabled'))

	if (buttonKey)
		if (typeof this.buttons[buttonKey] === 'undefined') {
			console.warn('Invalid escapeKey, no buttons found with key ' + buttonKey);
		} else {
			if (!this['$_' + buttonKey].prop('disabled'))
				this['$_' + buttonKey].trigger('click');
		}

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

1 participant