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

fix(VMenu): hover stuck open when mouse exits page #5844

Merged
merged 1 commit into from Dec 9, 2018

Conversation

parktheredcar
Copy link
Contributor

Description

It's possible for a mouseLeaveEvent to finish closing a menu before the corresponding mouseEnterEvent's animation frame has run, resulting in a stuck open menu. I have added some logic to double check at and make sure the menu is still active at the time the animation frame runs.

In this situation, isActive has been reset to false between the time runDelay(open) was called and when we were provisioned this animation frame, sync up hasJustFocused to false and do a no-op assign to isContentActive which doesn't trigger the watcher. Tried to minimize branching to match project style.

Motivation and Context

This is a fix for #5843, the issue is fully documented over there including related codepen.

How Has This Been Tested?

I have tested the hover functionality of v-menu and v-tooltip, including edge cases such as right clicking the mouse and exiting the page, and both are now working correctly.

Markup:

// Paste your FULL Playground.vue here
<template>
  <v-app>
      <v-toolbar app>
        <v-menu open-on-hover top offset-y>
          <v-btn
            slot="activator"
            color="primary"
          >
            Dropdown
          </v-btn>
          <v-list>
            <v-list-tile>
              <v-list-tile-title>List Item</v-list-tile-title>
            </v-list-tile>
          </v-list>
        </v-menu>
      </v-toolbar>
      <v-content app>
        <v-tooltip bottom>
          <span slot="activator">This text has a tooltip</span>
          <span>Tooltip</span>
        </v-tooltip>
      </v-content>
  </v-app>
</template>

<script>
  export default {
    data: () => ({
    })
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and breaking changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

Fix for vuetifyjs#5843 - in the event isActive has been reset to false between the time runDelay(open) was called and when we were provisioned this animation frame, sync up hasJustFocused to false and do a no-op assign to isContentActive which doesn't trigger the watcher. Resolve the promise although it's not really needed, just so we aren't breaking promises.
@vercel
Copy link

vercel bot commented Dec 8, 2018

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

@parktheredcar parktheredcar changed the title Fix #5843 v-menu hover stuck open fix(VMenu): hover stuck open when mouse exits page Dec 8, 2018
@codecov
Copy link

codecov bot commented Dec 8, 2018

Codecov Report

Merging #5844 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5844      +/-   ##
==========================================
- Coverage   89.07%   89.05%   -0.02%     
==========================================
  Files         262      262              
  Lines        5923     5923              
  Branches     1468     1468              
==========================================
- Hits         5276     5275       -1     
- Misses        531      532       +1     
  Partials      116      116
Impacted Files Coverage Δ
packages/vuetify/src/mixins/menuable.js 95.28% <100%> (ø) ⬆️
...fy/src/components/transitions/expand-transition.js 60% <0%> (-4%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01c1ac8...39600ac. Read the comment docs.

@johnleider johnleider merged commit 62ecb91 into vuetifyjs:master Dec 9, 2018
@lock
Copy link

lock bot commented Apr 14, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants