Skip to content
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

Allow "valid" placeholders for form inputs #383

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

mauromascarenhas
Copy link

Proposed changes

With the new proposal of "CSS only" floating labels, it was not possible to use placeholders as "valid" input hints. Therefore, this PR aims to force the users to provide only a single white space (" ") for placeholder attribute in floating label inputs, or the labels will be "always active", allowing "useful placeholders" to be displayed (see screenshots below).

Summary:

  • Inputs with floating labels must have a single white space (" ") as placeholder value;
  • Inputs with placeholder values other than a single whitespace will always render their respective labels in "active" state;
  • Updated docs so as to make it clear and reflect changes 😄.

Screenshots (if appropriate) or codepen:

Previous behaviour

Input labels overlaps "useful" placeholder values.

Form fields with valid placeholder values being overlaped by their respective labels

Current behaviour

Input labels are corectly rendered when "useful" placeholder values are provided.

Form fields with valid placeholder values being correcly rendered

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to change).

Checklist:

  • I have read the CONTRIBUTING document.
  • My commit messages follows the conventional commit format
  • My change requires a change to the documentation, and updated it accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Allow placeholders to be used with floating labels.

- Floating label inputs must have a single white space as placeholder;
- Label no longer overlap Inputs with "useful" placeholders.
Documentation for the usage of floating labels is simpler to understand:

- Updated code samples;
- Updated feature descriptions.
Copy link
Member

@wuda-io wuda-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks for the clear documentation 👍

@wuda-io wuda-io merged commit 807d65b into materializecss:v2-dev Jun 22, 2023
@mauromascarenhas mauromascarenhas deleted the floating-labels branch June 23, 2023 03:36
@wuda-io wuda-io mentioned this pull request Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants