惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
U
Unit 42
F
Fortinet All Blogs
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
Y
Y Combinator Blog
罗磊的独立博客
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
I
InfoQ
博客园 - 叶小钗
博客园 - 聂微东
Last Week in AI
Last Week in AI

Starred Articles

Why some people mow a lawn better than others Improvements to Web for AI Should Benefit All Users chriscoyier.net When Sites Need to Walk Away AI & Alignment New to the web platform in April  |  Blog  |  web.dev Delivering a dynamic hexagonal world map in just 10kb | Calibre My house alerts me when my cat climbs into the ceiling Eames Pavilion System Squarespace & Web Standards: How We Helped Bring HTML Video & Audio Lazy Loading to Today’s Browsers | Scott Jehl, Web Designer/Developer The Web is a Guitar Amp Now (Literally) Claude is an Electron App Making keyboard navigation effortless Miscalibrated I used Claude Code and GSD to build the accessibility tool I’ve always wanted - blakewatson.com Sizing chaos The Good & Not Good Scroll indicators on tables with background colours using animation-timeline Webspace Invaders Fresh Hot CSS: Trig Functions The Year Of The Linux Desktop (for fitness games) Almost Plain Text, Nicely Done – Email is good. Uncrate's 100-ish favorite things on Amazon VS Code – highlight just the active indent guide How musicals use motifs to tell stories Good Tidings! Review: MoErgo Go60, a split ergonomic and fully programmable keyboard The line and the stream. — Ethan Marcotte Testing HTML Light DOM Web Components: Easier Than Expected! Enhancing Web Components Safely with Self-Destructing CSS | Scott Jehl, Web Designer/Developer
closedBy=any · October 16, 2025
Adam Argyle · 2025-10-16 · via Starred Articles

Quick post on closedBy="any", a declarative way to add light-dismiss to a dialog:

<dialog closedBy="any">
  <p>Hi, I'm a dialog.</p>
</dialog>

And just like that, tapping or clicking outside the dialog will close it.

Oh yeah! Well I bet I can't use it yet. #

Here's the browser support:

Or a bit-o-js to get you started:

someDialog.addEventListener('click', ({target:dialog}) => {
  if (dialog.nodeName === 'DIALOG')
    dialog.close('dismiss')
})

More resources #

You should write one!

I'm writing this because I haven't seen enough folks using it or talking about it. Pretty nifty feature if ya ask me. So I'll make a 10m post.

If you want more <dialog> goodness, I wrote a fun post about how to make nice dialogs cuz the defaults are so poopy. Check it out and have a dialog.


Also checkout the Dialog Starter notebook!

10 comments #

@argyleink Agreed. Just included it in the progressive enhancement course I'm writing ;-)

Aaron GustafsonAaron Gustafson

@argyleink Another cool thing to add on my todo list ????????

FelixFelix

There should be a viewer discretion notice before showing variable shadowing like this. dialog.addEventListener('click', ({target:dialog}) => { if (dialog.nodeName === 'DIALOG') dialog.close('dismiss') })

Andreas MøllerAndreas Møller

I was trying to look into how you did that pwa install banner, to see if you meant to be using dvh instead of vh or something, as it stays floating when url bar hides when I scroll (I have url bar at bottom), but I couldn't find anything. Is that a chrome native thingy?

Carl VuorinenCarl Vuorinen