Skip to content

Commit

Permalink
Only apply css hover effect on non-touch devices (#5285)
Browse files Browse the repository at this point in the history
* Only apply hover effect on non-touch devices

Applying hover effect on touch devices has an undesired effect: The element gets set to hover state on touch and stays like that until the next touch event. 
Using the :active state gives a nicer feedback by highlighting the button only for the duration of the touch.

* add line to changelog
  • Loading branch information
digitaltom authored Jan 4, 2025
1 parent 0594669 commit dd93ae9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
- _...Add new stuff here..._

### 🐞 Bug fixes
- _...Add new stuff here..._

- Skip control button css hover effects on touch devices (https://github.com/maplibre/maplibre-gl-js/pull/5285)

## 5.0.0

Expand Down
10 changes: 8 additions & 2 deletions src/css/maplibre-gl.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,14 @@
opacity: 0.25;
}

.maplibregl-ctrl button:not(:disabled):hover {
background-color: rgb(0 0 0 / 5%);
@media (hover: hover) {
.maplibregl-ctrl button:not(:disabled):hover {
background-color: rgb(0 0 0/5%);
}
}

.maplibregl-ctrl button:not(:disabled):active {
background-color: rgb(0 0 0/5%);
}

.maplibregl-ctrl-group button:focus:focus-visible {
Expand Down

0 comments on commit dd93ae9

Please sign in to comment.