WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
298401
Slotted content in web components hidden due to slot display calculation
https://bugs.webkit.org/show_bug.cgi?id=298401
Summary
Slotted content in web components hidden due to slot display calculation
Péter Gaál
Reported
2025-09-04 09:42:25 PDT
We are working with custom web components and discovered a rendering issue that only occurs in Safari. Steps to reproduce: Create a <custom-radio-group> web component containing <custom-radio> elements. Set the invalid attribute on <custom-radio-group>. Expected result: The <custom-radio> labels remain visible. Actual result (Safari only): The <custom-radio> labels are hidden. Workaround: When the labels are already hidden (height: 0), applying a color CSS property to <custom-radio-group> makes them visible again. Reproducible example:
https://lit.dev/playground/#project=W3sibmFtZSI6InRlc3QudHMiLCJjb250ZW50IjoiaW1wb3J0IHsgaHRtbCwgY3NzLCBMaXRFbGVtZW50IH0gZnJvbSAnbGl0JztcbmltcG9ydCB7IGN1c3RvbUVsZW1lbnQsIHByb3BlcnR5IH0gZnJvbSAnbGl0L2RlY29yYXRvcnMuanMnO1xuXG5AY3VzdG9tRWxlbWVudCgnY3VzdG9tLXJhZGlvLWdyb3VwJylcbmV4cG9ydCBjbGFzcyBDdXN0b21SYWRpb0dyb3VwIGV4dGVuZHMgTGl0RWxlbWVudCB7XG4gIEBwcm9wZXJ0eSh7IHR5cGU6IEJvb2xlYW4gfSkgaW52YWxpZCA9IGZhbHNlO1xuXG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gaHRtbGBcbiAgICAgICAgPGRpdj5Hcm91cCBsYWJlbDwvZGl2PlxuICAgICAgICA8c2xvdD48L3Nsb3Q-XG4gICAgICAgIDxzbG90IG5hbWU9XCJmZWVkYmFja1wiPlxuXHRcdFx0PGN1c3RvbS1mZWVkYmFjayA_aW52YWxpZD1cIiR7dGhpcy5pbnZhbGlkfVwiPjwvY3VzdG9tLWZlZWRiYWNrPlxuXHRcdDwvc2xvdD5cbiAgICBgO1xuICB9XG59XG5cbkBjdXN0b21Fb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aXQtaHRtbFwiOiBcIl4zLjAuMFwiXG4gIH1cbn0iLCJoaWRkZW4iOnRydWV9XQ
Attachments
Add attachment
proposed patch, testcase, etc.
Péter Gaál
Comment 1
2025-09-04 10:33:31 PDT
If I change the <slot> display style from "contents" to "block", the bug is fixed. The issue appears to be related only to the calculation of the slot's display content property. This works correctly in all other browsers; the problem occurs only in Safari.
Radar WebKit Bug Importer
Comment 2
2025-09-04 10:42:08 PDT
<
rdar://problem/159866364
>
s.hagemann
Comment 3
2025-09-11 02:25:49 PDT
We are also experiencing this issue since updating to iOS 18.6.2 When slots are used in components the children within the slots are sometimes not rendered in the DOM, when they are not encapsulated within another HTML element. In our use case using the Ionic component framework, the following does not always render (ion-badge internally has a slotted element via shadow content): <ion-badge>Text</ion-badge> Workaround is to wrap the inner part in another element: <ion-badge><span>Text</span></ion-badge> This effectively breaks the UI of our app on iOS devices once users install the lastest iOS version.
Ahmad Saleem
Comment 4
2025-10-17 16:21:59 PDT
@Peter - does it impact
https://www.strivacity.com
live website? Or just something work-in-progress? Just trying to understand customer impact? Same question for @Hagemann?
Péter Gaál
Comment 5
2025-10-18 06:17:53 PDT
(In reply to Ahmad Saleem from
comment #4
)
> @Peter - does it impact
https://www.strivacity.com
live website? Or just > something work-in-progress? Just trying to understand customer impact? > > Same question for @Hagemann?
It impacts the login interfaces used by our customers. We use web components there, and our radio input fields are broken in Safari. A temporary fix is to override the <slot> element’s display property from contents to block.
s.hagemann
Comment 6
2025-10-19 23:26:00 PDT
Yes it does impact our production web applications. For us it only happens with unlucky combinations of iPhone screen sizes and webview rendered content height. So some users experience missing UI components which are not rendered. Which seems "random" for the user.
Antti Koivisto
Comment 7
2025-10-23 07:30:56 PDT
Minimal repro <!doctype html> <outer-custom id=c> <template shadowrootmode="open"> <div>outer </div> <slot></slot> <slot name="fail"> <inner-custom id=t> <template shadowrootmode="open"> <slot id="innerslot" name="foo"> inner</slot> </template> </inner-custom> </slot> </template> This should be visible. </outer-custom> <script> document.body.offsetLeft; const innerSlot = c.shadowRoot.getElementById("t").shadowRoot.getElementById("innerslot"); innerSlot.setAttribute("name", "foo"); </script>
Antti Koivisto
Comment 8
2025-10-23 08:47:51 PDT
This is an inline continuation bug (<span><div></div><span></span></span> essentially, with some mutations), the imminent refactoring to remove them fixes this.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug