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(vdialog): fix close on outside click with persist and hide-overlay #9304

Merged
merged 5 commits into from
Oct 24, 2019
Merged

fix(vdialog): fix close on outside click with persist and hide-overlay #9304

merged 5 commits into from
Oct 24, 2019

Conversation

ErikMikkelson
Copy link
Contributor

fix #8697

Description

When VDialog is persistent with hide-overlay set, we shouldn't dismiss on outside clicks. See #8697

Motivation and Context

Fixes #8697

How Has This Been Tested?

Tested against failing playgrounds from bug reports. New test added to VDialog.

Markup:

<template>
  <v-container>
    <v-row justify="center">
      <v-dialog v-model="dialog" persistent hide-overlay max-width="290">
        <template v-slot:activator="{ on }">
          <v-btn color="primary" dark v-on="on">Open Dialog</v-btn>
        </template>
        <v-card>
          <v-card-title class="headline">Use Google's location service?</v-card-title>
          <v-card-text>Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.</v-card-text>
          <v-card-actions>
            <div class="flex-grow-1"></div>
            <v-btn color="green darken-1" text @click="dialog = false">Disagree</v-btn>
            <v-btn color="green darken-1" text @click="dialog = false">Agree</v-btn>
          </v-card-actions>
        </v-card>
      </v-dialog>
    </v-row>
  </v-container>
</template>

<script>
export default {
  data: () => ({
      dialog: false
  })
}
</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 features but makes 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)
  • I've added new examples to the kitchen (applies to new features and breaking changes in core library)

Fixes an issue where VDialog would close on outside clicks if persist and hide-overlay were set.

fix #8697
Copy link
Member

@johnleider johnleider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be done easier. The second conditional that starts on line 180 is actually useless because the check is already handled above on line 165. It can simply be this:

if (this.persistent) {
  !this.noClickAnimation && this.animationClick()

  return false
}

Tested on your branch and all tests still pass.

ErikMikkelson and others added 2 commits October 11, 2019 22:15
ixes an issue where the dialog would still close on outside clicks when persistent and hide-overlay

fix #8697
@ErikMikkelson
Copy link
Contributor Author

Changes made as requested

@maurice-g
Copy link

Thanks guys! Really looking forward to this fix 🎊

Copy link
Member

@MajesticPotatoe MajesticPotatoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM, Great job!

@MajesticPotatoe MajesticPotatoe merged commit ba99a45 into vuetifyjs:master Oct 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 23, 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.

[Bug Report] Dialog won't behave as modal when hide-overlay prop is true
4 participants