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

Alignment issue with floating labels and small select (form-select-sm) padding in Bootstrap 5.3 #41008

Closed
3 tasks done
patrickzzz opened this issue Nov 5, 2024 · 2 comments · Fixed by #41013
Closed
3 tasks done

Comments

@patrickzzz
Copy link
Contributor

Prerequisites

Describe the issue

I have encountered an alignment issue when using Bootstrap 5.3’s floating labels with the small select element (form-select-sm). The selected value is misaligned, appearing further to the left than the floating label due to the reduced padding applied to the small select.

Steps to reproduce:

1.	Create a form with a floating label using the form-floating class.
2.	Include a select element with the class form-select-sm.
3.	Observe that the selected value does not align with the floating label.

Expected behavior:
The selected value should align correctly with the floating label, regardless of the select size.

Actual behavior:
The selected value is offset to the left, causing misalignment with the label.

For a reduced test case demonstrating this issue, please refer to my CodePen link: [VIew on Code Pen].

Reduced test cases

https://codepen.io/patrickzzz/pen/GRVXjLK

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

macOS

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

Chrome

What version of Bootstrap are you using?

v5.3.3 (latest)

@louismaximepiton
Copy link
Member

Hey there, thanks for your contribution!

I confirm that it doesn't work well with select sizes as mentioned in the doc.

That said, I'm fine having it in Bootstrap since it looks more logical. Feel free to open a PR around this subject.

@patrickzzz
Copy link
Contributor Author

Hi @louismaximepiton, thanks!
I added the PR: #41013
I kept the change minimal, as i saw, also in other places, a "*-padding-x" variable is only applied to either left/right (e.g.: https://github.com/twbs/bootstrap/blob/main/scss/forms/_form-select.scss#L11 ). Of course, the right padding shall not be changed, as it is place of the select-dropdown-arrow.

Regards,
Patrick

@patrickzzz patrickzzz reopened this Nov 7, 2024
@github-project-automation github-project-automation bot moved this to To do in v5.3.4 Nov 7, 2024
@julien-deramond julien-deramond moved this from To do to Needs review in v5.3.4 Nov 7, 2024
@louismaximepiton louismaximepiton moved this from Needs review to Ready to merge in v5.3.4 Nov 14, 2024
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in v5.3.4 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants