Skip to content

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

@jjbutera

Description

@jjbutera

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.

Activity

jjbutera

jjbutera commented on Nov 8, 2023

@jjbutera
Author

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jjbutera

        Issue actions

          Pressing escape when escapeKey is bound to a disabled button closes the dialog · Issue #584 · craftpip/jquery-confirm