oddbird / popover-polyfill

Polyfills the HTML popover attribute and showPopover/hidePopover/togglePopover methods onto HTMLElement, as well as the popovertarget and popovertargetaction attributes on <button> elements.
https://popover.oddbird.net
BSD 3-Clause "New" or "Revised" License
269 stars 14 forks source link

`_a.focus is not a function` with `delegatesFocus: true`, but no focusable element #154

Closed jpzwarte closed 1 year ago

jpzwarte commented 1 year ago

So my fix for #149 works as it's supposed to. The scenario I did not account for is when there is no focusable content in the web component. In that case focusDelegate still returns the ShadowRoot and then errors in the popoverFocusingSteps.

I think this is due to the TreeWalker code where isFocusable falls through all the if statements and then returns focusTarget.tabIndex !== -1 which is true for the ShadowRoot?

jgerigmeyer commented 1 year ago

@jpzwarte Thanks! Released in v0.3.5 🚀