Skip to content

Commit

Permalink
Fix submenu staying open if the mouse leaves the menu (#169)
Browse files Browse the repository at this point in the history
#### What problem is this solving?
Some cases, when the mouse leaves the parent item, the submenu remains open. This is common if the user moves from the menu to address bar or browser tab, also when it is combined with scrolldown.

#### How to test it?
[Workspace](https://storeframeworkdev--tafmxqa.myvtex.com/)

#### Screenshots or example usage:
**Before**

https://user-images.githubusercontent.com/23274114/187324819-1258d9ad-43fc-4cc8-abbd-d75c5365aec4.mp4

**After**

https://user-images.githubusercontent.com/23274114/187324739-5796c65d-c3d9-41c5-ae14-7ee605c048a7.mp4

#### Related to
PR: #108
  • Loading branch information
ivanlopezluna authored Dec 6, 2022
1 parent 9ae1a8a commit fd2327e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [Unreleased]
### Fixed
- Fix submenu stays open if mouse leaves menu.

## [2.34.25] - 2022-07-26
### Added
Expand Down
2 changes: 2 additions & 0 deletions react/hooks/useMouseSpeedDebouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const useMouseSpeedDebouncer = (
const speed = getMouseSpeed()
if (speed <= maxSpeed) {
fn(...args)
} else if (lastSpeed !== null && lastSpeed > maxSpeed) {
fn(...args)
} else if (lastSpeed == null || lastSpeed !== speed) {
timeout.current = window.setTimeout(check, delay)
}
Expand Down

0 comments on commit fd2327e

Please sign in to comment.