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

Custom file input label overflows input #27630

Closed
bbbenji opened this issue Nov 8, 2018 · 3 comments
Closed

Custom file input label overflows input #27630

bbbenji opened this issue Nov 8, 2018 · 3 comments

Comments

@bbbenji
Copy link

bbbenji commented Nov 8, 2018

When the label for a custom file input is too long, it overflows the input.

screenshot_20181108_113928

A quick solution is to set label {overflow: hidden;}

screenshot_20181108_114347

However this presents a new problem when label {font-size: <1rem;}

screenshot_20181108_114334

You might ask why you would put such a long label if no one is going to see the whole thing anyway. But this use case can apply when the window is resized horizontally or a script is used which updates the label with the name of the selected file.

EDIT: Looks like best solution is to add the .text-truncate to the given label.

@Johann-S
Copy link
Member

Johann-S commented Nov 8, 2018

There is another solution you can add for example a span inside the label see my example: https://codepen.io/Johann-S/pen/ZmWGpM

To dynamize my input file I use : https://www.npmjs.com/package/bs-custom-file-input

@bbbenji
Copy link
Author

bbbenji commented Nov 8, 2018

You can just add .text-truncate to the label, no need for the span.

Thanks for showing me that class.

However, I believe this still to be a bug. We should not have to add an additional class.

@Johann-S
Copy link
Member

Johann-S commented Nov 8, 2018

Closed as duplicate of: #26933

@Johann-S Johann-S closed this as completed Nov 8, 2018
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

No branches or pull requests

2 participants