Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that Boolean attributes should never be initialized to true if they should be configurable from markup #744

Closed
AndrewJakubowicz opened this issue Apr 6, 2022 · 1 comment
Assignees

Comments

@AndrewJakubowicz
Copy link
Contributor

AndrewJakubowicz commented Apr 6, 2022

Context

This is an area of confusion and we don't have clear documentation on lit.dev relating to this case.

Initializing a boolean attribute to true results in confusing behavior, as you cannot declaratively remove the attribute that has been defaulted to true from markup.

Proposal

Add a warning or note to https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions stating that boolean attributes should never be default initialized to true.

References

This has been discussed in the past:

Out of scope of this issue, but maybe this can be caught by the analyzer.

@AndrewJakubowicz AndrewJakubowicz changed the title Document that Boolean attributes should never be set to true. Document that Boolean attributes should never be initialized to true. Apr 6, 2022
@AndrewJakubowicz AndrewJakubowicz changed the title Document that Boolean attributes should never be initialized to true. Document that Boolean attributes should never be initialized to true if they should be configurable from markup Apr 6, 2022
@arthurevans arthurevans moved this to 🔥 Front Burner in Lit Project Board Apr 26, 2022
@arthurevans
Copy link
Contributor

This just came up in a chat conversation today, as well. I think it's really more apropos to the Reactive properties section, because it's really about the attribute API of a given component. We don't really talk much about API patterns at the moment.

@arthurevans arthurevans self-assigned this May 26, 2022
@augustjk augustjk moved this from 🔥 Front Burner to 📋 Triaged in Lit Project Board Sep 8, 2022
arthurevans pushed a commit that referenced this issue Oct 25, 2022
arthurevans pushed a commit that referenced this issue Oct 25, 2022
Repository owner moved this from 📋 Triaged to ✅ Done in Lit Project Board Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants