[Webkit-unassigned] [Bug 196457] Slot click events not fired after visibility change

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 1 23:19:21 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=196457

--- Comment #3 from Ryosuke Niwa <rniwa at webkit.org> ---
(In reply to David from comment #2)
> Hi, thx for the feedback. Your example could work has it is not a shadowed
> (shadow DOM) components.

?? The attached example totally uses shadow tree.

> The problem occurs in a Web Component respectively in a shadowed DOM
> components.
> 
> If you modify the :host visibility or the first container visibility, in
> both case then the click event isn't triggered anymore if you click on the
> SLOTTED elements
> 
> <my-components> <!-- If you change visibility on the host -->
> #shadow:root
> <div> <!-- Or if you change visibility on the first container -->
> <button>
> <slot name="test"/>
> </button>
> </div>
> <my-components>
> 
> 
> <span slot="test">In both case no click events</span>

Okay, the following example seems to work just fine:

<!DOCTYPE html>
<html>
<body>
<div id="host" style="visibility: hidden"><span slot="hello">H</span></div>
<button onclick="s = container.style; s.visibility = s.visibility == 'hidden' ? 'visible' : 'hidden'">Toggle</button>
<script>

const shadowRoot = host.attachShadow({mode: 'closed'});
shadowRoot.innerHTML = `
<div id="container">
    <button onclick="alert('clicked!')">
        <slot name="hello"></slot>
    </button>
</div>`;
window.container = shadowRoot.getElementById('container');

</script>
</body>
</html>

Could you just give us a complete HTML file which reproduces this issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190402/f96b5fa6/attachment.html>


More information about the webkit-unassigned mailing list