-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Placeholders should not be created automatically #497
Comments
Hi @Floriferous. Let's get through it step by step.
There's literally zero logic for displaying them, but there is an already mentioned If you have an idea on how to simplify it - I'm open to suggestions and PRs.
That's why it's disabled by default. If you are using a schema, which, somehow automagically, determines a correct placeholder, then using current logic you have an out-of-box solution, using
I agree. But again, provided that your schema contains a good placeholder, the current solution is a very good one. A problem for me, as a creator of this package, was to support most of the cases and not break the others. If such a thing was a goal here, I think that the current solution is good, as it's providing some placeholders for a quick look (and potentially a finished feature) and not getting in your way, if you plan to write your own.
OK, that's new. It was a decision a long time ago, and labels are currently only strings (placeholders too). It's really simple to fix that with an additional condition (type check) in
This is actually a thing of your theme - placeholders can be used anywhere, for example in a tooltip.
Maybe it's an idea to actually treat schema-level placeholder as a trigger to actually apply it. It would be a breaking change though, as if your schema actually returns a valid placeholder, it would be turned on by default now.
If you can't do it globally with your schema (a default placeholder of |
No answer so far, I'm closing. Feel free to comment anyway. |
The logic for displaying placeholders seems to be more complicated than necessary.
Reading through this bit of code and PR #152, makes your head spin for a fairly simple feature.
I think this package should not be generating placeholders automatically for people, as it is too opinionated. And there are a few other important reasons:
firstName
, only a small portion of the world actually wants to seeFirst Name
as the label, and even worse:First Name
as placeholder (given UX guideline above). It's cool to be able to display something fast for single-language MVP apps, but that's about it.label
s. For example, we're passing thelabel
directly to theAutoField
component as a prop, not via the schema. So all our labels are well translated, but the placeholder still showsFirst Name
.placeholder
prop expects a string, or else it displays[Object Object]
I think placeholders should be displayed if a placeholder is provided on the component/schema-field and that's it. Maybe add another prop called
autoPlaceholder
that generates them for you (which I recommend nobody actually use anyways), but the current status isn't great.We don't have placeholders for all our fields right now, so I'm left looping over my schema and give my fields empty placeholders to avoid the automatic unwanted ones?
The text was updated successfully, but these errors were encountered: