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

Floating Label: position is not correctly aligned #40734

Open
3 tasks done
Alken0 opened this issue Aug 15, 2024 · 6 comments · May be fixed by #40735
Open
3 tasks done

Floating Label: position is not correctly aligned #40734

Alken0 opened this issue Aug 15, 2024 · 6 comments · May be fixed by #40735
Labels

Comments

@Alken0
Copy link

Alken0 commented Aug 15, 2024

Prerequisites

Describe the issue

I saw that the labels of Floating-Label are not perfectly aligned while first messing around with incorrect ellipsis on 5.3 (which has ben fixed according to other issues).

This is a screenshot of the website of version 5.2 (to have a correct version):

image

I would suggest a change to display the label with a better alignmend to the sides:

image

Reduced test cases

The problem, why this occurs is in the following css-attribute:

.form-floating>.form-select~label
transform: scale(.85) translateY(-.5rem) translateX(.15rem)

The scale factor reduces the size that was 100% before the transform.
Therefore the real width is 100%*0.85 instead of 100%.

In addition, the alignment is not perfect regarding the left-side because of translateX and translateY.

I would suggest the following change:

.form-floating>.form-select~label
padding-top: 0.5rem /*same adjustment as the transformY to display the label above the input */
padding-bottom: 1.5rem /* adjust for transformY as well*/
font-size: 85% /* adjusts the size of the text in the same way as scale */

Thank you for your work!

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

v5.2 (not tested on 5.3)

@Alken0
Copy link
Author

Alken0 commented Aug 15, 2024

PS: the examples and code only show the select-input, but this issue effects ALL floating-labels.

@poswalsameer
Copy link

The PR #40735 fixes the issue of alignment of floating labels as mentioned by the author of this issue. The said change is done in the _variable.scss file by creating 3 new variables for padding-top, padding-bottom, and font-size which are injected in the forms/_floating-labels.scss file.

@Alken0, you can have a look too here.

Kindly merge this PR as soon as possible.

@Alken0 Alken0 closed this as completed Sep 3, 2024
@Alken0
Copy link
Author

Alken0 commented Sep 3, 2024

fixed in #40735

@Alken0
Copy link
Author

Alken0 commented Sep 3, 2024

The PR #40735 fixes the issue of alignment of floating labels as mentioned by the author of this issue. The said change is done in the _variable.scss file by creating 3 new variables for padding-top, padding-bottom, and font-size which are injected in the forms/_floating-labels.scss file.

@Alken0, you can have a look too here.

Kindly merge this PR as soon as possible.

@poswalsameer thank you very much for your work

@poswalsameer
Copy link

The PR #40735 fixes the issue of alignment of floating labels as mentioned by the author of this issue. The said change is done in the _variable.scss file by creating 3 new variables for padding-top, padding-bottom, and font-size which are injected in the forms/_floating-labels.scss file.
@Alken0, you can have a look too here.
Kindly merge this PR as soon as possible.

@poswalsameer thank you very much for your work

Thanks a lot!

@poswalsameer
Copy link

Hi @julien-deramond, I have created a PR that solves the said issue, can you please review it and let me know if further changes are required? Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants