Skip to content

class:/style: directives can be overridden by class/style attributes #13270

Closed
@dummdidumm

Description

@dummdidumm

Describe the bug

I'm not sure if this is related to #13171 or not, but class:/style: directives can be overridden by class/style attributes, which they shouldn't - the directives always take precedent. It happens if the class:/style: directive doesn't update/rerun while the corresponding class/style attribute does update.

The solution is probably to ensure that the directives are always in the same template effect as the corresponding attributes so that they rerun. Alternatively there's some hidden property on the DOM elements that tells them what other classes should be on there at that point.

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACl2P4WrDMAyEX0WIjaQ0kLGfmeOy51jGcB1lNXGdYMspw_jdhxfGRn_qdLr7lHAylgJ2bwmduhJ2-Lqu2CB_rWUIG1kmbDAs0euiiKC9WVkObmBLDJuykaCHh8CKqX46vAyu7KboNJvFwaj8XB9S0Qb2xNE7YB-p-DjfmT-JP7RVIdxf7DWP8AwnqG4Xw1RBB9XZKj1Xv1Gi_YNzYjQb_GR1BaFPO0jetT79q8pStKPZ5ODEOTIvDhanrdFzn-pDL_fy4zHLcDOsL6LdXRIbvC6jmQyN2JWf8nv-BkMMS5xSAQAA

Logs

No response

System Info

irrelevant

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions