Bootstrap: Blurry text in Bootstrap dropdown menu

Created on 21 Aug 2017  Â·  21Comments  Â·  Source: twbs/bootstrap

By default popper.js uses the CSS 3d transformation for positioning of dropdown menu. This transform property causes font rendering issues in WebKit-based browsers. It would be nice to add native popper.js option computeStyle.gpuAcceleration into Bootstrap dropdown plugin to allow users to choose which type of positioning to use.

js v4

Most helpful comment

Given this may not be fixable, a gpuAcceleration option would help fix this for the affected platforms.

If the device's pixel ratio is below 1.5 and is a Windows device, set the option to false.

$('#element').popover({
  gpuAcceleration: !(window.devicePixelRatio < 1.5 && /Win/.test(navigator.platform))
})

All 21 comments

Why you say it causes issues in webkit browsers? It doesn't cause any issue if the 3d transformation doesn't make use of half pixels (Popper.js makes sure to not use half pixels).

May you provide more info about your browser and OS?

FezVrasta, thank you for the comment.

OS Windows 10. Browser Chrome 60.0.3112.101.
Compare these screenshots:
1) https://prnt.sc/gb785b (with _transform_).
2) https://prnt.sc/gb78mp (without _transform_ and _will-change_).

As you can see, the text looks a bit blurry in the first example.

The pictures have very low quality so they actually look the same to me, any chance to get a CodePen or JSFiddle to reproduce the problem?

Take a look here http://sergius.16mb.com (Google map toolbar). Both _transform_ and _will-change_ affect type rendering.

If I see it correctly greyscale anti-aliasing is used in one screenshot while subpixel anti-aliasing is used in the other one.

AFAIR, various browsers can have various reasons for switching to grayscale AA, e.g. transparent background, subpixel positioning, recent repositioning or other transformations, …

I don't see anything blurred both on macOS and Windows 10 actually

@FezVrasta On high DPI setups you might not notice the difference, because if the pixels are very small it makes no difference whether full or subpixels are used for AA.

@Herst is correct, the "ClearType" Windows uses is being disabled. You need to zoom right in to see the difference in anti-aliasing.

Before vs after

Left = with transform, right = without in his screenshots.

They are just two different kind of anti aliasing, but neither of them looks blurry

May you try to set -webkit-font-smoothing: antialiased; or -webkit-font-smoothing: subpixel-antialiased; to the popper element and see if it helps?

neither of them looks blurry

This is subjective.

Ref #21132 from the days of Tether.

Still waiting for feedbacks on this:
https://github.com/twbs/bootstrap/issues/23590#issuecomment-323987562

if it works I can fix this on Popper.js side of things.

May you try to set -webkit-font-smoothing: antialiased; or -webkit-font-smoothing: subpixel-antialiased; to the popper element and see if it helps?

It was the first thing that came to my mind, but unfortunately it doesn't help.

Given this may not be fixable, a gpuAcceleration option would help fix this for the affected platforms.

If the device's pixel ratio is below 1.5 and is a Windows device, set the option to false.

$('#element').popover({
  gpuAcceleration: !(window.devicePixelRatio < 1.5 && /Win/.test(navigator.platform))
})

Please have a look to the attached screenshot attached screenshot are from bootstrap 4 main website

tempsnip
tempsnip1

Is this still an issue?

No, it is not. Now there is a built-in option which allows users to disable Popper.js.

I'm having this issue with tooltips. How exactly can I resolve this? Disabling popper.js gpu acceleration?

edit: removing transform: translate3d() fixes the blur but breaks positioning...

You can disable gpu acceleration, right

@FezVrasta terribly sorry to bother you with such trivial matters, but could you provide a snippet of how to do this? (inside .js file)

Actually I don't use Bootstrap anymore (it's been few years already) so I'm not able to help unfortunately.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bellwood picture bellwood  Â·  3Comments

knownasilya picture knownasilya  Â·  3Comments

kamov picture kamov  Â·  3Comments

ziyi2 picture ziyi2  Â·  3Comments

matsava picture matsava  Â·  3Comments