-
Notifications
You must be signed in to change notification settings - Fork 4
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
Check boolean attributes presence, not value #71
Comments
I spoke to @nelson-glauber about this, here is my understanding: There are certain Jetpack components that have attributes with default values of <RadioButton selected={false}> will render <RadioButton> but because Jetpack has a default value for <RadioButton selected={false}> this should instead render <RadioButton selected=false> Currently @nelson-glauber is working around this by using a stringified value of the boolean: <RadioButton selected={Atom.to_string(false)}> this will correctly render: <RadioButton selected="false"> and @nelson-glauber is typecasting this back to |
I personally think it's clearer if you just swap the default on the client. If you always pass @nelson-glauber Do you have an example of a component that has an argument with a default value of |
@carson-katri if there are similar compromises being made in the SwiftUI client that would be against our stated goal of achieving as close to feature parity with the target framework as possible. We really need to divorce our thinking away from HTML and the limits and specification there and think of this as a markup representation of the target UI framework. We have no influence over the upstream framework's API and need to conform to those expectations and not deviate for the convenience of what works in HTML. |
I found one instance of a |
Adding this link for future reference: |
Closed by liveview-native/live_view_native#138 |
Currently, the client is checking if boolean attributes (like
selected
) are equal to the string"true"
. However, boolean attributes in HTML are intended to be read by presence. If the attribute is on the element it's true, even if the value is the string"false"
. If the attribute is not present, the value is false.With this approach, users can pass bools in without encoding them as strings. LiveView should automatically add/remove the attribute from the template.
The HTML Specification makes this note:
The text was updated successfully, but these errors were encountered: