yairEO / tagify

🔖 lightweight, efficient Tags input component in Vanilla JS / React / Angular / Vue
https://yaireo.github.io/tagify/
Other
3.51k stars 432 forks source link

Line height issue with certain fonts #768

Closed RichardD2 closed 3 years ago

RichardD2 commented 3 years ago

Prerequisites

💥 Demo Page

https://jsfiddle.net/RichardD/rkmgs84t/1/

Explanation

When using particular fonts and font sizes, having the line-height set to 1.1 causes descenders to be obscured - specifically for lower-case letters g, j, p, q, and y. In this specific case, I'm using Bootstrap 4.6, which sets:

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 1rem;
}

https://jsfiddle.net/RichardD/rkmgs84t/1/ image

Workaround:

Setting line-height: inherit; on both the .tagify and .tagify__input::before rules resolves the problem:

.tagify,
.tagify__input::before {
    line-height: inherit !important;
}

https://jsfiddle.net/RichardD/rkmgs84t/2/ image

yairEO commented 3 years ago

I originally wanted to not use inherit because I was thinking the developer could not be trusted with having a good-looking line-height by default, so I had it set to 1.1. I will contemplate of a solution

Funny because I was just reading this article recently: https://css-tricks.com/how-to-tame-line-height-in-css