NEW280399
Conditionally rendered slot elements causes other slots to be hidden
https://bugs.webkit.org/show_bug.cgi?id=280399
Summary Conditionally rendered slot elements causes other slots to be hidden
Hans Krywalsky
Reported 2024-09-26 02:38:08 PDT
Hey there, this is the first bug i report here. If you need any more info or help from me, please let me know. We mentioned a strange bug on our website, after we updated to ios18/macOS15: After an element renders a conditionally `slot` element, other `slot` elements on the same page gets removed. We use lit webcomponents and i also was able to create a very simple reproduction. I started a new default lit project and added simple components. Link: https://github.com/EinfachHans/ios18-slot-bug The steps to make it run are described in there. When you press on "toggle" another slot element is added to the page. In the same moment the slot from the headline component just gets hidden.
Attachments
Mathias R.
Comment 1 2024-10-01 02:33:08 PDT
Hi, we're facing the same Bug in a Project with conditionally rendered slots. In addition to Hans' explanation, I would like to add that this only seems to occur with elements whose slots have display: contents and contain text nodes. If you set the slot to e.g. display: block or wrap the text in an element such as span, p or div, the error does not occur. In his example that would mean using <my-headline><span>Headline</span></my-headline> in my-app.ts would work.
Radar WebKit Bug Importer
Comment 2 2024-10-03 02:39:15 PDT
j.r.jurman
Comment 3 2025-11-17 22:50:00 PST
This came up in a recent Web Awesome issue (see https://github.com/shoelace-style/webawesome/issues/1771). I was able to recreate a minimal codepen that does not use lit here - https://codepen.io/JRJurman/pen/vEGmWoZ I'm going to attempt to build a web platform test for this next. I'll follow up here when that exists.
j.r.jurman
Comment 4 2025-11-18 01:07:17 PST
PR is here - https://github.com/web-platform-tests/wpt/pull/56083 In the process of putting that together, I noticed that the bug is not reproducible in the latest Safari Technology Preview - Release 232 (WebKit 21624.1.2.19.2).
Note You need to log in before you can comment on or make changes to this bug.