next: [data-state]
Attribute Conflicts in Component Compositions
#923
Labels
enhancement
An improvement to an existing feature/component
Describe the bug
Based on #823 , there's a systemic issue with component composition where multiple components using the same
[data-state]
attribute conflict with each other. IMO it is something to decide before 1.0. While the Toggle and Tooltip example demonstrates this problem, it affects any combination of components that rely on the[data-state]
(or similiar) attribute for styling and state management.Current Behavior
Expected Behavior
Elements should be styleable based on each component's state independently, regardless of how many components are composed together
Impact
Example
Details
Current Style Conflicts
Details
Proposed Solutions
Solution 1: Component-Specific Data Attributes
Use distinct data attributes for each component type:Each component gets its own attribute
Pros:
Cons:
Solution 2: Combined State Values
Use a single
data-state
attribute with combined values:Pros:
Cons:
Reproduction
https://stackblitz.com/edit/stackblitz-starters-xdgpeu?file=src%2Froutes%2F%2Bpage.svelte
Logs
No response
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: