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

Ability to disable auto focus on close button #2735

Closed
maxkopych opened this issue Jun 17, 2024 · 1 comment
Closed

Ability to disable auto focus on close button #2735

maxkopych opened this issue Jun 17, 2024 · 1 comment

Comments

@maxkopych
Copy link

maxkopych commented Jun 17, 2024

New feature motivation

Probably should have option to disable auto focus on close button
image

Right now I'm creating hack to prevent it:

didOpen: () => {
    if (document.activeElement?.classList.contains("swal2-close")) {
        document.activeElement.blur();
    }
},

New feature description

No response

New feature implementation

No response

@limonte
Copy link
Member

limonte commented Jun 18, 2024

Hello @maxkopych and thanks for the nice request 🙌

Blurring the focused element isn't quite accessible, I wouldn't recommend that.

Instead of that, I added the support for elements with autofocus attribute: #2736

Also, the example from your screenshot is updated now to reflect the changes: https://sweetalert2.github.io/#custom-html

Hopefully, that would also work for you.

@limonte limonte closed this as completed Jun 18, 2024
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

2 participants