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

v5: Floating labels #30449

Merged
merged 15 commits into from Oct 28, 2020
Merged

v5: Floating labels #30449

merged 15 commits into from Oct 28, 2020

Conversation

mdo
Copy link
Member

@mdo mdo commented Mar 25, 2020

@mdo mdo requested a review from a team as a code owner March 25, 2020 00:59
@mdo mdo added this to Inbox in v5.0.0-alpha2 via automation Mar 25, 2020
@micka-fdz
Copy link

Good news! Is it possible to add support for <textarea> and .form-file elements?

@MartijnCuppens
Copy link
Member

It feels a bit odd to me that the label doesn't shrink when The input field is focused, it looks like you're going to type in text before the password text:
image

I would prefer:
image

Thoughts?

@alecpl
Copy link
Contributor

alecpl commented Mar 30, 2020

  1. The "placeholder" color is wrong. Should be grey-ish, now it uses input text color. Is this something possible to fix?
  2. I think I would prefer the way it looks as proposed in Feature Request: Floating Labels #21312 (comment)

@mdo mdo changed the base branch from master to main June 16, 2020 20:04
@mdo mdo added this to Inbox in v5.0.0-alpha3 via automation Aug 3, 2020
@mdo mdo removed this from Inbox in v5.0.0-alpha2 Aug 3, 2020
@mdo
Copy link
Member Author

mdo commented Sep 17, 2020

Pushed some changes based on the code review and fixing some conflicts. Also made the change from @MartijnCuppens's suggestion and moved the label on :focus now, too. I dig!

Added textarea support too, @micka-fdz. Unsure about file inputs... those ones are more complicated. Could be an add-on in the future once this gets settled.

@mdo
Copy link
Member Author

mdo commented Sep 21, 2020

Pushed some more updates to address @MartijnCuppens's comments. Wondering if there's some more I can do to make this more bulletproof. Happy to hear out any comments!

@mdo
Copy link
Member Author

mdo commented Oct 26, 2020

This should be good to go now! Can I get a final review?

mdo and others added 12 commits October 26, 2020 16:46
- Adds new .form-floating
- Stubs out basics of a docs page
- Removes existing Example
…ts more consistent

- To do this, I made the .form-control and .form-select consistent in min-height vs height
- Removed some unused variables now
- Updated -color to be the -color because I don't know why this was any different before
- Update page to include some examples for layout, validation, and value
- Rewrite styles to not modify padding, but instead transform and opacity
- Apply some optimizations from code review
- Removed unecessary properties from the label
- Add some comments for what properties are required
- Move from fixed height for labels to height 100% so we can support textareas
- Improve docs a little bit, add ToC
@alecpl
Copy link
Contributor

alecpl commented Oct 27, 2020

I think I don't like these big inputs (and with strange padding when they are empty). Something like in #30449 (comment) would be better.

@micka-fdz
Copy link

I agree, fields are currently much too big.
I prefer this render : https://getbootstrap.com/docs/4.5/examples/floating-labels/

@MartijnCuppens
Copy link
Member

#30449 (comment) would require an additional background to fix the border and shadow overlap

image

This will look weird if the parent element has another background
image

Or if the background of the input is semi-transparent:
image

But I can agree the input looks a little to big. https://getbootstrap.com/docs/4.5/examples/floating-labels/ might indeed be a better look as @micka-fdz suggests.

@alecpl
Copy link
Contributor

alecpl commented Oct 27, 2020

Semi-transparent input is a rare-case that could be just unsupported by floating labels. The other label background issue I could live with if the padding-top was smaller (and maybe with rounded corners). Still I would prefer this over what's proposed in the PR.

@alecpl
Copy link
Contributor

alecpl commented Oct 27, 2020

@mdo, in firefox 82 on linux the label animation has some issue. When you focus the input there are two steps of the animation visible, first the label moves up, then it's font size drops to even smaller. Maybe it's a firefox's transform/scale bug. Looks like when the text is moving it is blured then it sharpens. I don't see this in Chrome.

v5.0.0-alpha3 automation moved this from Review to Approved Oct 27, 2020
pointer-events: none;
border: $input-border-width solid transparent; // Required for aligning label's text with the input as it affects inner box model
transform-origin: 0 0;
@include transition(opacity .1s ease-in-out, transform .1s ease-in-out);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this value be variable, as we do with $input-transition?
Apart from that, seems fine!

Copy link
Member

@ffoodd ffoodd Oct 27, 2020

Choose a reason for hiding this comment

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

Trying this on both Firefox & Chromium on Ubuntu, I can see a little font rendering jump (more obvious on Firefox). I guess it can be related to the font-stack I updated recently—already mentionned a related bug in #31955 by @MartijnCuppens.

That's unrelated to the PR I guess, I'd need more testing on those using our old font-stack and compare other possibilities… Opening an issue to track this. Edit: #31991

@mdo mdo requested a review from a team as a code owner October 28, 2020 03:02
@mdo mdo merged commit 3e2f9ab into main Oct 28, 2020
v5.0.0-alpha3 automation moved this from Approved to Shipped Oct 28, 2020
@mdo mdo deleted the v5-floating-labels branch October 28, 2020 03:45
@micka-fdz
Copy link

micka-fdz commented Oct 30, 2020

Hi @MartijnCuppens, what about my suggestion of inputs height? I think it’s a quick modification. Maybe can I help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v5.0.0-alpha3
  
Shipped
Development

Successfully merging this pull request may close these issues.

Feature Request: Floating Labels
10 participants