See the code in action.

Learn one idea at a time. Each Knowledge Bite starts with a practical question and shows you how to check the answer.

Knowledge Bite #001Vue Teleport

Why does the panel clip my modal?

Follow the confirm button before and after moving the dialog with Teleport.

Video in English 0:46

Read the transcript

00:01 Your dialog just opened. So where did the Confirm button go?

00:06 Look at the bottom of this panel.

00:08 The dialog uses fixed positioning, but the panel has a transform.

00:13 That makes it the reference point.

00:15 With overflow set to hidden, the panel clips the button.

00:19 In Vue, wrap the dialog in Teleport and target the body element.

00:24 Watch what happens. The dialog starts inside the panel.

00:28 Turn Teleport on, and it moves under body. There’s the button.

00:33 Click Confirm, and the parent still updates the counter.

00:37 The DOM location changed. Props and events still work.

00:40 In a real dialog, remember keyboard focus too.

Why is my Vue dialog clipped?

The Confirm button exists in the DOM, but the article panel clips it. The dialog uses fixed positioning. Its ancestor has a CSS transform, which establishes the containing block for this fixed descendant. The panel also has hidden overflow, so the button falls outside the visible area. Increasing the dialog’s stacking order would leave that clipping boundary in place.

App.vue wraps the dialog in Vue’s built-in Teleport component. Turning on the checkbox changes its physical parent from the article panel to the document body. The dialog escapes the panel and Confirm becomes clickable.

The parent component still supplies the title prop and listens for the child’s confirmation event. In the English browser fixture, clicking Confirm closes the dialog and updates the parent’s counter to one. The test captured both states and checked the hit target at the center of the button. Browser evidence.

Use Teleport when an overlay needs to leave an ancestor’s layout constraints. A production dialog also needs focus management, a keyboard dismissal policy and appropriate background interaction. This example isolates positioning and event handling.

Original example and captures by Knowvore. The Vue guide text is licensed under CC BY 4.0, credited to Evan You and Vue documentation contributors. Vue Teleport guide · Documentation license.

Try Teleport

Look at the clipped dialog. Turn Teleport on, click Confirm, and watch the counter reach 1.

Open the interactive example
Drafts panel with the bottom of the dialog hidden.
Teleport off · the panel clips the dialog
Full dialog outside the clipping area, with the Confirm button visible.
Teleport on · the button is accessible