Skip to content

Distinguish placeholders/examples from user supplied values #320

@eoghanmurray

Description

@eoghanmurray

What would you like?

Preamble: It seems that this lib does something under the hood that I don't understand;
for a given <input type="text" id="x" .... placeholder="XYZ" value="XYZ"> before form submission, if you inspect the x.value parameter it is the empty string (vs. the x.getAttribute("value") as per the HTML).
The actual value does get submitted though somehow?

I'd like to be able to make a distinction in my custom CSS to change the appearance of the text when placeholder content is used, however it appears the library is 'abusing' the placeholder system as a mechanism to show the value when the parameter is blank. Would it be a big change to instead set the value (when it is set) and leave it out when no value has been supplied?
I'm thinking of the 'no value has been supplied' case as being 'not entered by the user' i.e. one of the example values coming in vs. a default value which should be submitted — there might be a mismatch here in my mental model of how things work.

To summarize, I'm requesting

  • example values - should go to the placeholder attr
  • user supplied values should be in the value parameter
  • default values - should prefill the field as per user values

Why is this needed?

It's very hard to distinguish between 'real' values that you've supplied and example values that should be noticeable as needing a real value before submission in the api playground.

How could it be implemented?

I'm creating this as an issue as I'm not sure whether the maintainers would see this as a goal, and/or whether this would be too big of a change in the codebase. If it's a goer I'll attempt it in a separate PR.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions