There are many ways to implement modal popups in web development these days, but they all expect you to import a library and implement their approach.

I am a big fan of using a native approach to interaction wherever possible. It frees you from dependence of third-parties and gives you a cleaner codebase.

The Modal

Let’s start with the modal element - the html dialog element. This will give us largely all the functionality that external libraries give you but with some other nice bits. For instance, pressing ESC will cancel the dialog. You also don’t need to worry about z-indexes or some janky DIV that pretends to be a backdrop.

I will paste the code I am using in a current project and you can hopefully infer the necessary bits you need to know.

<dialog id="utili...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help