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

focusDelegate method doesn't handle custom elements where [autofocus] is in the light DOM (slotted) #149

Closed
jpzwarte opened this issue Nov 24, 2023 · 0 comments · Fixed by #150

Comments

@jpzwarte
Copy link
Contributor

The focusDelegate method (

function focusDelegate(focusTarget: HTMLElement) {
) checks if the focusTarget has a shadowRoot and if delegatesFocus is enabled.

If it does, it looks for [autofocus] in the shadow root and returns it if found.

It doesn't take the scenario into account where the [autofocus] element is in the light DOM and slotted into the shadow root. focusDelegate will return the shadowRoot itself in that case.

When it is back in the popoverFocusingSteps method it tries to call focus() on the return value, but since shadowRoot does not implement that method, it causes an error (Uncaught TypeError: _a.focus is not a function in FF).

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

Successfully merging a pull request may close this issue.

1 participant