Skip to content

Add support for Shadow DOM open mode #32

@ritz078

Description

@ritz078

Description

Currently, the text-spacing-editor tool may have limitations when working with web components that use Shadow DOM in open mode. This feature request is to enhance support for measuring and adjusting text spacing on elements rendered within open Shadow DOM trees.

Problem Statement

Web components using Shadow DOM (especially open mode) provide encapsulation while still allowing external access to the DOM tree. However, text spacing adjustments may not properly cascade or be accessible when elements are contained within Shadow DOM boundaries. This limits the tool's utility for modern web applications that heavily rely on web components.

Proposed Solution

Add native support for:

  1. Detecting and traversing open Shadow DOM trees
  2. Applying text spacing adjustments to text nodes within Shadow DOM elements
  3. Calculating proper spacing metrics that account for Shadow DOM encapsulation
  4. Ensuring CSS custom properties and inherited styles properly affect Shadow DOM content

Use Cases

  • Modern web applications built with web components (e.g., those using Lit, Stencil, or vanilla web components)
  • Accessibility tools that need to adjust text spacing across all visible text, including component internals
  • Design systems that use Shadow DOM for style encapsulation

Additional Context

Shadow DOM open mode allows external scripts and styles to access and modify the DOM, making it an ideal candidate for enhancement. This would make the tool more compatible with the current web component ecosystem.

Related

If there are any existing issues or discussions about web component support, please link them here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions