Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

All PropTypes are 'string' #71

Closed
Closed

Description

@rmarren1

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?

Activity

  1. rmarren1 commented on Sep 27, 2018

    @rmarren1
    ContributorAuthor

    ...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

  2. T4rk1n commented on Sep 27, 2018

    @T4rk1n
    Contributor

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

  3. rmarren1 commented on Sep 27, 2018

    @rmarren1
    ContributorAuthor

    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.

  4. T4rk1n commented on Sep 27, 2018

    @T4rk1n
    Contributor

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

    the value column got some typing info.

  5. rmarren1 commented on Oct 18, 2018

    @rmarren1
    ContributorAuthor

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions