Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

All PropTypes are 'string' #71

Closed
rmarren1 opened this issue Sep 27, 2018 · 5 comments
Closed

All PropTypes are 'string' #71

rmarren1 opened this issue Sep 27, 2018 · 5 comments

Comments

@rmarren1
Copy link
Contributor

A detail I noticed with the property validation PR is that all properties that are not n_click, n_click_timestamp and children in dash-html-components are strings.

Some HTML props sort of behave like they are booleans, numbers, ect. and are transparently serialized to a string. For example, Details.open can be set to True which will serialize as 'true', HTML interprets this as the presence of a string and sets the value open to be true.

This pattern currently breaks with the property validation PR (plotly/dash#340) since props have PropType.string, you would have to set the value to be 'true' or some other string.

I haven't been able to find a good resource that has each HTML attribute and its type, so I was thinking of just not validating anything from dash-html-components since having to convert everything to a string would get tedious.

Anyone have any thoughts on this / ideas to remedy?

@rmarren1
Copy link
Contributor Author

...or rather than completely punting, we can only validate children, since that is probably the only prop that causes serious issues in dash-html-components

@T4rk1n
Copy link
Contributor

T4rk1n commented Sep 27, 2018

HTML attributes are all strings in the tags like xml, it's the jsx that have types.

@rmarren1
Copy link
Contributor Author

Yeah, I guess I meant to say a resource that maps each HTML attribute to the type it would have if HTML had a typing system like jsx does. The Mozilla docs does this sometimes, e.g. saying Details.open is a boolean attribute, but that documentation is pretty inconsistent and not parsable.

@T4rk1n
Copy link
Contributor

T4rk1n commented Sep 27, 2018

https://www.w3schools.com/tags/tag_textarea.asp

the value column got some typing info.

@rmarren1
Copy link
Contributor Author

Only validating the children has been working pretty and no real problems were caused. We can revisit this is some issues come up

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants