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

Escape does not return focus to triggering element SVG #282

Open
bnjmnrsh opened this issue Jun 2, 2022 · 0 comments
Open

Escape does not return focus to triggering element SVG #282

bnjmnrsh opened this issue Jun 2, 2022 · 0 comments

Comments

@bnjmnrsh
Copy link

bnjmnrsh commented Jun 2, 2022

I've run into an issue with v3.0.0-dev, where with keyboard navigation, focus is not returned to the initial element (within an SVG) when using the escape key.

the offending lines

            // We return focus only if the current focus is inside this instance
            if (
                activeElement
                // &&
                // (
                //     document.activeElement === element[0] ||
                //     $.contains(element[0], document.activeElement)
                // )
            ) {
                try {
                    activeElement?.focus();  // optional chaining
                } catch (e) {
                  // Ignore exceptions, eg. for SVG elements which can't be
                  // focused in IE11
                  console.log(e);
                }
            }

Im my tests removing the checks and applying optional chaining on the activeElement?.focus(); results in the ideal behaviour, but obviously breaks IE11 compatibility.

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