<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>308330</bug_id>
          <alias>JoelWess</alias>
          <creation_ts>2026-02-20 13:41:25 -0800</creation_ts>
          <short_desc>@scope&apos;d styles don&apos;t affect &lt;slot&gt;&apos;d elements, but they should</short_desc>
          <delta_ts>2026-05-12 10:41:47 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari 26</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>joel.wesseling</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>devhassan941</cc>
    
    <cc>koivisto</cc>
    
    <cc>onur</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2183521</commentid>
    <comment_count>0</comment_count>
    <who name="">joel.wesseling</who>
    <bug_when>2026-02-20 13:41:25 -0800</bug_when>
    <thetext>When a CSS style is defined inside a `@scope`, that style has no effect on DOM elements that are passed into the &lt;slot&gt; of a native Custom Element (Web Component).

This issue is happening in Safari &gt;= 26.2. It does not happen in Safari 26.1 or 18.x, nor does it happen in Chrome or Firefox.

I have created a minimal reproduction in the following CodePen:
https://codepen.io/JoelWess/pen/zxBgpBN

Both &lt;h1&gt; should be purple in the following example, but the first &lt;h1&gt; is green in Safari 26.2:

```html
&lt;div class=&quot;test-scope&quot;&gt;
  &lt;x-card&gt;
    &lt;h1 slot=&quot;heading&quot;&gt;Slotted H1&lt;/h1&gt;
    &lt;p&gt;Card content&lt;/p&gt;
  &lt;/x-card&gt;

  &lt;h1&gt;Unslotted H1&lt;/h1&gt;
&lt;/div&gt;
```

```css
/* Baseline: should work in every browser even when the &lt;h1&gt; is slotted */
h1 {
  color: green;
}

/* The bug: this should ALSO match, because &lt;h1&gt; is in the light DOM and is a child of .test-scope */
@scope (.test-scope) {
  h1 {
    color: purple;
  }
}
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2185654</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-02-27 13:42:13 -0800</bug_when>
    <thetext>&lt;rdar://problem/171383788&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2199014</commentid>
    <comment_count>2</comment_count>
    <who name="Nipun Shukla">nipun_shukla</who>
    <bug_when>2026-04-10 16:43:47 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/62502</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2200872</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-04-15 17:08:45 -0700</bug_when>
    <thetext>Committed 311333@main (00497eb486c0): &lt;https://commits.webkit.org/311333@main&gt;

Reviewed commits have been landed. Closing PR #62502 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2201255</commentid>
    <comment_count>4</comment_count>
    <who name="Nipun Shukla">nipun_shukla</who>
    <bug_when>2026-04-16 15:46:53 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/59298</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2208609</commentid>
    <comment_count>5</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2026-05-07 09:14:32 -0700</bug_when>
    <thetext>*** Bug 307982 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2210173</commentid>
    <comment_count>6</comment_count>
    <who name="Onur Gumus">onur</who>
    <bug_when>2026-05-12 10:41:47 -0700</bug_when>
    <thetext>*** Bug 307238 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>