00:00
Buy Me a Beer

Accessible Webflow popup modal

Display a popup when a button is clicked with Tab trap and Custom Focusable element.

open popup

How to build a popup modal in Webflow

Firstly, make sure you have the VisualDX script before your </body>. Checkout the Quick Start for how to do this.

Create Open Button

Copy this attribute:

vdx-popup-open

Paste the attribute into the Custom Attributes Name field of a Webflow Button.In the Value field add a unique identifier.

Body
Button
Custom Element
Button
Form Block
Form
Input
Button
Style
Settings
Interactions
Link Settings
Custom Attributes
Name
vdx-popup-open
Value
accessible-popup

Create Popup Element

Copy this attribute:

vdx-popup-popup

Paste the attribute into the Custom Attributes Name field of a Webflow Div Block or Custom Element. In the Value field add the same unique identifier as the popup button.

Body
Button
Custom Element
Button
Form Block
Form
Input
Custom Element
Style
Settings
Interactions
Div Settings
Tag
Div
Custom Attributes
Name
vdx-popup-popup
Value
accessible-popup

Create Popup Close Button

Copy this attribute:

vdx-popup-close

Paste the attribute into the Custom Attributes Name field of a Webflow Buttonwhich is a child of the Popup. Note: we do not need a value here.

Body
Button
Custom Element
Button
Form Block
Form
Input
Button
Style
Settings
Interactions
Link Settings
Custom Attributes
Name
vdx-popup-close
Value

Convert Custom Element to Dialog

In the settings if a Custom Element change the Tag from a Div to a Dialog. This will set the popup to Display: none.

Body
Button
Dialog
Button
Form Block
Form
Input
Dialog
Style
Settings
Interactions
Dialog Settings
Tag
dialog
Custom Attributes
Name
vdx-popup-popup
Value
accessible-popup

Select Custom Focusible element

Copy this attribute:

vdx-popup-focus

Paste the attribute into the Custom Attributes Name field of a Webflow Input (Text Field) of a Webflow Form.

Body
Button
Dialog
Button
Form Block
Form
Text Field
Text Field
Style
Settings
Interactions
Text Field Settings
Custom Attributes
Name
vdx-popup-focus
Value

Add animations to popup child elements

In this example the From Block will move from a starting position of 32px below to it's original position in 1000ms with an easing of Ease.

Copy this Combo Class:

vdx--open

Paste the combo class into a style selector of Form Block .

Style your  the combo classes. eg. Set the Transforms to 0px and give the width transition a time of 1000ms and easing of Ease.

Body
Button
Dialog
Button
Form Block
Form
Text Field
Collection Item
Style
Settings
Interactions
Style Selector
Form Block
vdx--open
2D & 3D Transforms
Move: 0px, 0px, 0px
Transitions
Transform: 1000ms
Easing
ease

Delete the combo class and update the Transform Y to -32 px and Transitions to 500ms.

Body
Button
Dialog
Button
Form Block
Form
Text Field
Collection Item
Style
Settings
Interactions
Style Selector
Form Block
2D & 3D Transforms
Move: 0px, -32px, 0px
Transitions
Transform: 500ms
Easing
ease

Publish

Sponsor the Magic and
Buy Me a Beer

Ailín Tobin
Ireland

VisualDX is a free JavaScript library made for Webflow nerds like yourself. No ads, no paywalls—just pure, unfiltered JavaScript magic to supercharge your builds. If it’s saving you time, making your development easier, or just making you feel like a wizard in the Webflow Designer, consider slinging a virtual coffee my way.

Think of it like buying me a pint for keeping your Webflow spells flowing.

You can support it here.

Cheers, legend!

This is a method based on community and soundness. If you can't afford it, don't worry... One of your fellow Webflow nerds has already helped you out by donating.