Using 'selected' attribute with Lit components in Astro breaks after PR #12027 #13250
Open
1 task done
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Following PR #12027 (which added
selected
to Astro's list of boolean attributes), using theselected
attribute to pass non-boolean values to Lit components in Astro is now broken, asselected
is treated as a boolean attribute.After PR #12027 was merged, the
selected
attribute was added to Astro's boolean attributes list. This means that in Astro templates,selected
is now treated strictly as a boolean attribute rather than allowing string or other values.This creates compatibility issues when using Lit components that expect non-boolean values through a
selected
attribute, such as:The component receives the selected attribute as a boolean rather than the string value, causing type errors and broken functionality.
Affected Components
Any Lit components using selected attribute for non-boolean values
Custom elements that expect string/object values through selected attribute
What's the expected result?
the selected attribute should be treated as a string/object value but instead it's now being treated as a boolean attribute by Astro. This means:
Expected behavior:
Actual behavior:
This breaks any component logic that expects to receive string values through the selected attribute.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-qib1knph?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: