Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Slotted elements not added to Custom Web Component in iOS

I'm developing a custom web component and when I add options inside via tag, those are not rendered for iOS browsers.

const template = document.createElement('template');

template.innerHTML = `

    <style>
        .my-wrapper {
            height: auto;
            background: #eee;
        }
    </style>

    <div class="my-wrapper">
        <slot name="my-slot"></slot>
    </div>

`;

class MyComponent extends HTMLElement {

    constructor() {
        super()
        .attachShadow({mode:"open"})
        .appendChild(template.content.cloneNode(true));
    }

}

window.customElements.define('my-component', MyComponent);
<my-component>
  <option slot="my-slot">A</option>
  <option slot="my-slot">B</option>
  <option slot="my-slot">C</option>
  <option slot="my-slot">D</option>
</my-component>

Also available in CodePen: https://codepen.io/agarcav/pen/oNEBZRg

This example works in Chrome Desktop. The slotted elements are added to the web component and they expand it.

Screenshot from Chrome Desktop: enter image description here

Is there any needed config in Safari browsers I am missing?

I've googled it but I couldn't find this as a documented bug. According to Can I use the support is 100%;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It turns out the problem was the tag is not rendered in Safari if it's not inside <select>, <optgroup> or <datalist>. Although it's rendered in Chrome and other browsers.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!