Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 14, 2025

Tab panel content was losing inherited styles (color, font-family) when cloned into shadow DOM, resetting to browser defaults instead of respecting surrounding context.

Changes

  • Added color: inherit to :host and [role="tabpanel"] to allow inherited properties to flow through shadow boundary
  • Implemented 20+ documented CSS custom properties that were in JSDoc but not in actual CSS:
    • --tabbed-interface-font-family
    • --tabbed-interface-tablist-{display,gap,padding,margin,background,border}
    • --tabbed-interface-tab-{padding,background,color,border,border-radius}
    • --tabbed-interface-tab-{active,hover}-{background,color}
    • --tabbed-interface-tab-focus-outline
    • --tabbed-interface-tabpanel-{padding,background,border}

Usage

Inherited properties now flow naturally:

<style>
  .themed { color: #667eea; font-family: Georgia, serif; }
</style>
<div class="themed">
  <tabbed-interface>
    <h2>Tab 1</h2>
    <p>This inherits color and font from parent</p>
  </tabbed-interface>
</div>

Custom properties allow full customization:

tabbed-interface {
  --tabbed-interface-tab-active-background: #667eea;
  --tabbed-interface-tabpanel-padding: 2em;
}

Testing

Added test/style-inheritance.test.js with 7 tests covering inheritance behavior and custom property application. Created demo/style-inheritance.html demonstrating multiple themed examples.

All changes are backward compatible—default values match original hardcoded values.

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] Styles not inheriting</issue_title>
<issue_description>## Description

Tab panels should retain te styles of the surrounding content, while still enabling authors to direct specific styles at the elements when they are in a tabpanel.

Steps to Reproduce

  1. View styles before the tabepanel is created. Note backgrounds, etc.
  2. View the styles on the element after being wrapped in a tabpanel and note they are browser defaults

Expected Behavior

Styles should pierce into the component

Actual Behavior

Styles are reset.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits December 14, 2025 15:41
Co-authored-by: aarongustafson <75736+aarongustafson@users.noreply.github.com>
- Add color: inherit to :host to allow text color to flow from outside
- Implement all documented CSS custom properties for tablist, tab, and tabpanel
- Add color: inherit to tabpanel to pass text color to content
- This allows better style inheritance through the shadow DOM boundary

Co-authored-by: aarongustafson <75736+aarongustafson@users.noreply.github.com>
- Test color inheritance through shadow DOM
- Test CSS custom properties for tabpanel, tab, tablist
- Test font-family inheritance
- Verify that color: inherit is properly set

Co-authored-by: aarongustafson <75736+aarongustafson@users.noreply.github.com>
- Demonstrates color and font inheritance through shadow DOM
- Shows CSS custom properties in action
- Includes before/after comparison
- Multiple themed examples (dark, elegant, code-style)
- Documents all available CSS custom properties

Co-authored-by: aarongustafson <75736+aarongustafson@users.noreply.github.com>
Co-authored-by: aarongustafson <75736+aarongustafson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix styles not inheriting in tab panels Implement CSS custom properties and fix style inheritance through shadow DOM Dec 14, 2025
Copilot AI requested a review from aarongustafson December 14, 2025 15:52
@aarongustafson aarongustafson marked this pull request as ready for review December 29, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Styles not inheriting

2 participants