Custom file LABEL text overlapping neighbouring HTML elements on Firefox
See original GitHub issueOn Firefox 63 (but not on Chrome 70, Edge 44 nor Safari 12), the text in the “custom-file-label” LABEL element seems to invisibly overlap the neighbouring button INPUT element and prevents from clicking on it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
</head>
<body>
<div class="form-row" style="width: 400px">
<div class="form-group col">
<div class="custom-file">
<input type="file" class="custom-file-input" id="browser">
<label class="custom-file-label" for="browser">long_filename.txt</label>
</div>
</div>
<div class="form-group col">
<input type="button" value="Load" class="btn btn-primary">
</div>
</div>
</body>
</html>
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Overlapping lines of text on online forms | Firefox Support Forum
In today's case I could see that 2 lines of text were overlapped. ... have found that an html code was not functioning...
Read more ><input/> inside <label> not working in Firefox - Stack Overflow
You can reorganize the HTML structure to be valid and follow the spec and still get the effect you want.
Read more >How To Adjust the Content, Padding, Border, and Margins of ...
The CSS Box Model. An HTML element can be understood as a series of four overlapping boxes: The content box is the innermost...
Read more >HTML and CSS Tutorial - Nanyang Technological University
An HTML document is a text document, and it is human-readable. ... Open the file in a browser (such as Firefox, Internet Explorer/Edge,...
Read more >The "Checkbox Hack" (and things you can do with it)
The “Checkbox Hack” is where you use a connected <label> and <input type="checkbox"> and usually some other element you are trying to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Using
.text-truncateon the label would be a workaround, but not a real fix and is not perfect. All we need is:@mdo, Add https://github.com/twbs/bootstrap/pull/28388#issuecomment-468898020 to this and you have nice custom input fixes for v4 😉
@bbbenji Thank you for the fix. However it does not seem to work.
The only fix that works for me:
And to display an ellipsis (‘…’, U+2026 HORIZONTAL ELLIPSIS) to represent clipped text—instead of truncating it—, this works for me:
However displaying an ellipsis has a drawback: you now have to know the
padding-rightCSS property (here I measured 90 px for the “Browse” text of the custom file INPUT, but for other languages the padding would be different).So the fixed example is this:
So, if the fact that we didn’t get the expected behaviour in Firefox
overflow: hidden;CSS property to the.custom-fileCSS class.