bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Add :hover media query back

Open maxshearer opened this issue 10 months ago • 1 comments

Prerequisites

Proposal

Back in 2018/v4 a decision was made in #25270 to deprecate a hover media query due to the relatively low browser support and as such requirement of a shim to make it work.

Now the hover media query is widely supported I propose that the $enable-hover-media-query flag is added back in.

Motivation and context

To quote the original v4 docs explaining the flag:

While :hover isn’t possible on most touch devices, iOS emulates this behavior, resulting in “sticky” hover styles that persist after tapping one element. These hover styles are only removed when users tap another element. This behavior is considered largely undesirable and appears to not be an issue on Android or Windows devices.

For better or for worse this is still an issue in iOS and it would be useful to have the option to safely alleviate it.

I'm more than happy to submit a PR if it feels like there's appetite to go ahead implementing this.

maxshearer avatar Feb 14 '25 10:02 maxshearer

I'd be interested in seeing an isolated/limited proof of concept in a PR to experiment with. From a cursory glance at things, using the any-hover media query feels like a right first step, and could either be a mixin or a simple media query.

@media (any-hover) {
  // ...
}

@include any-hover {
  // ...
}

Unsure if we'd need any arguments to be passed through honestly, but hopefully you could think through some ideas there.

This would likely be a v6 thing as well if I'm understanding the potential scope here.

mdo avatar Apr 11 '25 04:04 mdo