question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Add ability to listen for transition events on v-dialog

See original GitHub issue

Problem to solve

Sometimes it is needed to run some code when v-dialog closes but do it only after closing animation ends, the problem is that at the moment there seems to be no way to determine when it ends.

Proposed solution

A possible solution would be to pass $listeners from v-dialog to the transition component. E.g.

if (this.transition) {
  dialog = h('transition', {
    on: this.$listeners,
    props: {
      name: this.transition,
      origin: this.origin
    }
  }, [dialog]);
}

So that it could be used like this:

<v-dialog v-model="isDialogActive" width="500" @after-leave="runSomeCode">

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:31
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
b-strausscommented, Mar 3, 2020

Use this function to patch the original component and forward the $listeners object.

import {VDialog as VDialogOriginal} from 'vuetify/lib';

/**
 * Hack to patch VDialog because it has no way to set transition hooks
 */
function patchVDialog (VDialog) {
  const ExtendedVDialog = VDialog.extend({});
  const originalRender = ExtendedVDialog.prototype.constructor.options.render;

  ExtendedVDialog.prototype.constructor.options.render = function (h) {
    const originalH = h;
    h = (...args) => {
      // Check for the call to render a transition,
      // there is only one rendered transition in VDialog
      if (args[0] === 'transition') {
        // Forward the user provided listeners to the transition component
        args[1].on = this.$listeners;
      }

      return originalH(...args);
    };
    return originalRender.call(this, h);
  };

  return ExtendedVDialog;
}

// This can be used now in place of the original.
const VDialog = patchVDialog(VDialogOriginal);
2reactions
brunlidcommented, May 7, 2020

Any news on when there will be working transition hooks for v-dialog? I cannot get any of transitionend or after-enter to trigger. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

v-dialog API - Vuetify
name type default #activator any undefined #attach any false #close‑delay number | string 0
Read more >
Dialog Interface Reference | Alexa Skills Kit - Amazon Developer
The Dialog interface provides directives for managing a multi-turn conversation between your skill and the user. You can use the directives to ask...
Read more >
Building a dialog component - web.dev
A foundational overview of how to build color-adaptive, responsive, and accessible mini and mega modals with the element.
Read more >
Voice Browser Call Control: CCXML Version 1.0 - W3C
CCXML is designed to provide telephony call control support for dialog systems, ... is paid to constraining ECMAScript features that require proportionately ...
Read more >
Activity state changes - Android Developers
Activity or dialog appears in foreground; User presses or gestures Back ... can cause an Activity to transition from one state to another....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found