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
The issue is when using web components export (we use this to embed svelte in legacy pages), the mousedown event for popovers (likely modals as well) aren't checking for shadowroot target, adding check for composedPath() from event does actually cehck the correct target, where as the typical event.target defaults to the top level container as a web component. See below fix
functionhandleMousedown(event){lettarget=event.target;if(popoverState!==PopoverStates.Open)return;if($button?.contains(target))return;if($panel?.contains(target))return;// below two lines are a fix that seems to workconstpotentialShadowRootTarget=event.composedPath()[0];if($panel?.contains(potentialShadowRootTarget))return;$api.closePopover();}
To Reproduce
simply put a link in the content of a popoverPanel, and make sure the bundling uses customElement: true. (svelte dev api - web components) below is our example loader an
Snippet inside PopoverPanel
Here is a <a href="http://google.com" target="_blank"><Button link>google link.</Button></a>. Can you click it? it should not register this inside web component shadow root context
For the time being a workaround if you can afford it is to on:mousedown={(e) => { e.stopPropagation() } on a menu item or popoverpanel main container div
Describe the bug
The issue is when using web components export (we use this to embed svelte in legacy pages), the mousedown event for popovers (likely modals as well) aren't checking for shadowroot target, adding check for composedPath() from event does actually cehck the correct target, where as the typical event.target defaults to the top level container as a web component. See below fix
To Reproduce
simply put a link in the content of a popoverPanel, and make sure the bundling uses
customElement: true
. (svelte dev api - web components) below is our example loader anSnippet inside PopoverPanel
Webpack config (customElement: true)
Library version
1.0.2
The text was updated successfully, but these errors were encountered: