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

Blurry text in Bootstrap dropdown menu #23590

Closed
Sir-Genius opened this issue Aug 21, 2017 · 22 comments
Closed

Blurry text in Bootstrap dropdown menu #23590

Sir-Genius opened this issue Aug 21, 2017 · 22 comments
Labels

Comments

@Sir-Genius
Copy link
Contributor

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.

@FezVrasta
Copy link
Contributor

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?

@Sir-Genius
Copy link
Contributor Author

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.

@FezVrasta
Copy link
Contributor

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?

@Sir-Genius
Copy link
Contributor Author

Take a look here http://sergius.16mb.com (Google map toolbar). Both transform and will-change affect type rendering.

@Sir-Genius Sir-Genius changed the title Blurry text in Bootstrap dropdown menu (Chrome 60.0.3112.101) Blurry text in Bootstrap dropdown menu Aug 21, 2017
@Herst
Copy link
Contributor

Herst commented Aug 21, 2017

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, …

@FezVrasta
Copy link
Contributor

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

@Herst
Copy link
Contributor

Herst commented Aug 21, 2017

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

@atomiks
Copy link

atomiks commented Aug 22, 2017

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

@FezVrasta
Copy link
Contributor

FezVrasta commented Aug 22, 2017

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?

@Herst
Copy link
Contributor

Herst commented Aug 22, 2017

neither of them looks blurry

This is subjective.

@bardiharborow
Copy link
Member

Ref #21132 from the days of Tether.

@FezVrasta
Copy link
Contributor

Still waiting for feedbacks on this:
#23590 (comment)

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

@Sir-Genius
Copy link
Contributor Author

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.

@atomiks
Copy link

atomiks commented Aug 23, 2017

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))
})

@Sahil1111
Copy link

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

tempsnip
tempsnip1

@XhmikosR
Copy link
Member

Is this still an issue?

@Sir-Genius
Copy link
Contributor Author

Sir-Genius commented Oct 21, 2018

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

@owensco
Copy link

owensco commented Nov 2, 2018

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

@FezVrasta
Copy link
Contributor

You can disable gpu acceleration, right

@owensco
Copy link

owensco commented Nov 2, 2018

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

@FezVrasta
Copy link
Contributor

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

aab-odoo added a commit to odoo-dev/odoo that referenced this issue May 6, 2019
This rev. disables Popper.js 3d transformation for positioning
bootstrap dropdowns in navbar, as this transformation causes a
rendering issue on webkit-based browsers (the text in the dropdown
is blurry).

See twbs/bootstrap#23590

Note that it has already been disabled for the other menu dropdowns
(user menu, debug menu) by rev. 5373db1.

Another solution would have been to override the default value in
our bootstrap.js extension file, but for dropdowns that aren't in
the navbar, the dynamic positionning could be interesting.

Fixes odoo#33096
robodoo pushed a commit to odoo/odoo that referenced this issue May 6, 2019
This rev. disables Popper.js 3d transformation for positioning
bootstrap dropdowns in navbar, as this transformation causes a
rendering issue on webkit-based browsers (the text in the dropdown
is blurry).

See twbs/bootstrap#23590

Note that it has already been disabled for the other menu dropdowns
(user menu, debug menu) by rev. 5373db1.

Another solution would have been to override the default value in
our bootstrap.js extension file, but for dropdowns that aren't in
the navbar, the dynamic positionning could be interesting.

Fixes #33096

closes #33174

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
@mindswoosh
Copy link

mindswoosh commented May 24, 2022

It seems like Chrome is a moving target for this. Following the idea of using transform, I got the left-side (grey-scale) of @atomiks example to work using transform: rotateY(0); Fontawesome icons, when colored using something other than black or grey, look terrible when antialiasing occurs with multiple colors. Using the transform, all the antialiasing is done in the same color as the icon. So for green icons, everything is done in green as opposed to adding orangish and blueish pixels in the mix.

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

No branches or pull requests

10 participants