You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If sl-dropdown is consumed within the shadow root of another component, the handleDocumentKeyDown() method is unable to accurately obtain the activeElement. (In this case, document.activeElement returns the name of the containing shadow root, rather than the active element within that shadow root.) This causes a problem if attempting to tab into a dropdown's slotted content such as form elements.
To Reproduce
Steps to reproduce the behavior:
Create a new Stencil component with shadow: true
In the new component's render method, return a sl-dropdown with a form input in the default slot.
Using the new component, use keyboard navigation to focus and open the dropdown. Then press Tab to focus into the slotted form input.
Dropdown closes, preventing use of the form input.
Expected behavior
User should be able to tab into the form input as expected without the dropdown closing.
@claviska would you mind reopening it? I still face this issue when the sl-dropdown is consumed deeper in the shadow root of another component, as @zolk's fix looks only at the first shadow root level. Here's a minimum reproduction.
After fixing that, I noticed the same thing happens when you render anything that is not a sl-menu, such as a nav with links, because it can't properly find the closest containing element to compare (I admit I didn't fully comprehend why).
Describe the bug
If
sl-dropdown
is consumed within the shadow root of another component, thehandleDocumentKeyDown()
method is unable to accurately obtain theactiveElement
. (In this case,document.activeElement
returns the name of the containing shadow root, rather than the active element within that shadow root.) This causes a problem if attempting to tab into a dropdown's slotted content such as form elements.To Reproduce
Steps to reproduce the behavior:
shadow: true
sl-dropdown
with a form input in the default slot.Expected behavior
User should be able to tab into the form input as expected without the dropdown closing.
Screenshots

Branch with minimum reproduction
zolk@63e23c7
The text was updated successfully, but these errors were encountered: