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

focus-trap returns an error on Safari 15.3 and lower #996

Closed
msev opened this issue Jul 4, 2023 · 9 comments · Fixed by #997
Closed

focus-trap returns an error on Safari 15.3 and lower #996

msev opened this issue Jul 4, 2023 · 9 comments · Fixed by #997
Labels

Comments

@msev
Copy link

msev commented Jul 4, 2023

Hi,

Since 7.5.0, focus-trap is broken on Safari (macOS, iOS) on 15.3 and lower.

When I initialize focus-trap, the console returns the following error:

focus-trap-findLast

I think it comes from findLast(), whose support is relatively recent.

Do you think you can fix this problem?

@msev msev changed the title findLast() returns an error in Safari 15.3 and lower findLast() returns an error on Safari 15.3 and lower Jul 4, 2023
@msev msev changed the title findLast() returns an error on Safari 15.3 and lower focus-trap returns an error on Safari 15.3 and lower Jul 4, 2023
@stefcameron
Copy link
Member

@msev Thank you. Very sorry about that. This will be fixed shortly.

@DaviDevMod FYI...

@stefcameron stefcameron added the bug label Jul 4, 2023
@DaviDevMod
Copy link
Contributor

Apologies, that was my bad.

I'm going to send a PR to fix it.

DaviDevMod added a commit to DaviDevMod/focus-trap-not-mine that referenced this issue Jul 4, 2023
stefcameron added a commit that referenced this issue Jul 4, 2023
* Remove references to `Array.prototype.findLast()`

Because it doesn't have acceptable browser support.
https://caniuse.com/mdn-javascript_builtins_array_findlast

Fixes #996

* Add changeset

---------

Co-authored-by: Stefan Cameron <stefan@stefcameron.com>
@msev
Copy link
Author

msev commented Jul 4, 2023

Thanks @stefcameron and @DaviDevMod

@stefcameron
Copy link
Member

@all-contributors add @msev for bug

@allcontributors
Copy link
Contributor

@stefcameron

I've put up a pull request to add @msev! 🎉

@stefcameron
Copy link
Member

stefcameron commented Jul 4, 2023

The "with positive tab indexes" demo is one that uses the findLast() (and now our fix to that) and it runs in Safari (albeit 16.5.1; the only version I have) without issue. Hopefully we've got our bases covered now.

@stefcameron
Copy link
Member

Fix published in v7.5.2

@msev
Copy link
Author

msev commented Jul 5, 2023

For your information, I've updated to version 7.5.2 and everything works well on Safari (13/14/15).

Thanks again for the patch!

@stefcameron
Copy link
Member

Awesome! 😅 You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants