question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hover-media-query

See original GitHub issue

I was looking into hover-media-query, which landed in bootstrap 4 at some point in the past. There is even a little snippet of documentation about it here:

https://getbootstrap.com/docs/4.0/getting-started/browsers-devices/#sticky-hoverfocus-on-mobile

However, it appears that this $enable-hover-media-query is commented out in the src scss file and has no effect.

I was hopeful that the hover classes could be controlled with something like .touch on the <body> element, but it doesn’t appear that this class works that way, as the mixin is inside of the element and can’t be escaped…

Aside from this, as you probably know, the hover media query has two problems:

  1. It isn’t supported in Safari (solved by using your shim https://github.com/twbs/mq4-hover-shim)
  2. It doesn’t really “work” for multiple-input devices, where a user could touch and mouse

After reading https://codepen.io/MillerTime/post/prepend-body-classes-to-nested-selectors-sass-mixin, I realized the same thing as the author: That you can use the & anywhere in the selector, and easily create body .no-touch classes using the existing hover mixin within bootstrap.

I propose that this could land in bootstrap easily by means of a simple selector like:

https://github.com/twbs/bootstrap/pull/25181

Now all I need to do is set the variable in my own personal custom variables file, e.g.:

$enable-hover-selector: ':not(body.touch)'

Works great!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

0reactions
mdocommented, Apr 1, 2018

We removed the hover-media-query awhile back, so I think this is safe to close. Let me know if it needs to be re-opened to track a particular change for us.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hover - CSS: Cascading Style Sheets - MDN Web Docs
The hover CSS media feature can be used to test whether the user's primary input mechanism can hover over elements.
Read more >
A Guide To Hover And Pointer Media Queries
The hover media query allows us to detect the user's primary input mechanism can hover over elements. It can have two values: none...
Read more >
Solving Sticky Hover States with @media (hover - CSS-Tricks
The solution, or trick, is a new(ish) “CSS4” media query that allows you only to apply styles on devices with hover capability.
Read more >
Media query for devices supporting hover - css - Stack Overflow
Please don't use the media query "hover". I'm working with a mouse on my 27" monitor, but all of my browsers have the...
Read more >
CSS at-rule: `@media`: `hover` media feature - CanIUse
1 Before Chrome 41, the implementation was buggy and reported (hover: none) on non-touch-based computers with a mouse/trackpad. See bug 441613.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found