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

Truncate floating labels #36270

Closed
3 tasks done
gerhard-lechner opened this issue May 3, 2022 · 2 comments · Fixed by #36873
Closed
3 tasks done

Truncate floating labels #36270

gerhard-lechner opened this issue May 3, 2022 · 2 comments · Fixed by #36873
Labels

Comments

@gerhard-lechner
Copy link

gerhard-lechner commented May 3, 2022

Prerequisites

Describe the issue

I realised that floating labels tend to get ugly if the label text is longer than the input field, pls see my pen link below.

This can be fixed by adding .w-100 and .text-truncate to the label. However, I would like to suggest that this should be the default without the need for any additional classes as a multiline floating label is never desirable.

Reduced test cases

https://codepen.io/gerhard-lechner/pen/GRQgQyW

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.1

@mdo
Copy link
Member

mdo commented May 3, 2022

What's the typical use case for super long labels like that?

@mdo mdo changed the title Provide a general summary of the issue Truncate floating labels May 3, 2022
@gerhard-lechner
Copy link
Author

Sorry about the title.

My real-world scenario is more a combination of a smaller field (on mobile) and a somewhat longer label: In a registration form you can enter a name prefix like "Dr." and also a name suffix like "MBA". These fields are typically not very large as the input value is most likely short too. In German one would use labels like "Titel vorangestellt" and "Titel nachgestellt". So not super long, but can be a bit longer than the field on mobile, see screenshots attached.

desktop

mobile

When cutting these labels you still get what the input value ought to be and avoid kind of a UI bug ...

fixed

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

Successfully merging a pull request may close this issue.

2 participants