Skip to content

Instantly share code, notes, and snippets.

View yannvanhalewyn's full-sized avatar
♥️
Making beautiful things

Yann Vanhalewyn yannvanhalewyn

♥️
Making beautiful things
  • Unconditional Software
  • Utrecht, Netherlands
View GitHub Profile
@jreviews
jreviews / modal-behavior._hs
Last active August 16, 2024 00:32
Hyperscript modal behavior
behavior Modal
init
set my focusRing to (<a, button, input:not([type=hidden]), textarea, select, details/> in me) as Array
end
on open
remove .hide
add { overflow: 'hidden' } to the <body/>
transition <[data-backdrop], [data-content]/> in me opacity from 0 to 1 over 0.3s
focus() the first <input/> in me