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

Can't focus to some input element after closing sweetAlert #1604

Closed
TonnTamerlan opened this issue May 31, 2019 · 4 comments
Closed

Can't focus to some input element after closing sweetAlert #1604

TonnTamerlan opened this issue May 31, 2019 · 4 comments

Comments

@TonnTamerlan
Copy link

TonnTamerlan commented May 31, 2019

Current behavior

I try to focus on some input element after closing sweetAlert but it doesn't happen: the focus appears and immediately disappear.
I use swetAlert (v. "8.11.6") and React (v. "16.5.2")

await MySwal.fire({
                title: "Empty account name",
                type: "warning",
                text: "Enter account name please",
                confirmButtonColor: "#009616",
                confirmButtonText: "Ok",
                width: "850px",
            });
this.inputAccNameRef.current.focus();

Expected behavior

After closing sweetAlert specific element should be focused

Live demo

await MySwal.fire({
                title: "Empty account name",
                type: "warning",
                text: "Enter account name please",
                confirmButtonColor: "#009616",
                confirmButtonText: "Ok",
                width: "850px",
            });
this.inputAccNameRef.current.focus();
@limonte
Copy link
Member

limonte commented May 31, 2019

Swal.fire({
  didClose: () => {
    // focus your element
  }
})

@limonte limonte closed this as completed May 31, 2019
@TonnTamerlan
Copy link
Author

@limonte
Thanks

@franciscoarnaldog
Copy link

SweetAlert2: Unknown parameter "onAfterClose"

@limonte
Copy link
Member

limonte commented Apr 3, 2022

SweetAlert2: Unknown parameter "onAfterClose"

onAfterClose was removed in v11.0.0, use didClose instead.

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