{"id":7498,"date":"2025-10-23T14:33:19","date_gmt":"2025-10-23T19:33:19","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=7498"},"modified":"2025-10-23T14:33:21","modified_gmt":"2025-10-23T19:33:21","slug":"closedbyany","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/closedbyany\/","title":{"rendered":"closedby=&#8221;any&#8221;"},"content":{"rendered":"\n<p>I&#8217;m <a href=\"https:\/\/nerdy.dev\/closedby-any\">just hearing about<\/a> the <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/HTMLDialogElement\/closedBy\">closedby=\"any\"<\/a><\/code> attribute\/value for <code>&lt;dialog><\/code>. HTML <code>popover<\/code>s have this &#8220;light dismiss&#8221; behavior where you can &#8220;click outside&#8221; to close them, but not dialogs (until this). <a href=\"https:\/\/codepen.io\/editor\/chriscoyier\/pen\/019a1287-763d-742c-9c8e-f4016e08961e\">I forked a previous demo<\/a> to try it and it works great (in Chrome &amp; Firefox, just waiting for Safari). I&#8217;ve been using a custom <code>&lt;ClickOutsideDetector \/><\/code> element for ages, so this is a welcome feature.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_019a1287-763d-742c-9c8e-f4016e08961e\" src=\"\/\/codepen.io\/editor\/anon\/embed\/019a1287-763d-742c-9c8e-f4016e08961e?height=450&amp;theme-id=1&amp;slug-hash=019a1287-763d-742c-9c8e-f4016e08961e&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed 019a1287-763d-742c-9c8e-f4016e08961e\" title=\"CodePen Embed 019a1287-763d-742c-9c8e-f4016e08961e\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m just hearing about the closedby=&#8221;any&#8221; attribute\/value for &lt;dialog>. HTML popovers have this &#8220;light dismiss&#8221; behavior where you can &#8220;click outside&#8221; to close them, but not dialogs (until this). I forked a previous demo to try it and it works great (in Chrome &amp; Firefox, just waiting for Safari). I&#8217;ve been using a custom &lt;ClickOutsideDetector [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7500,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[414,98,31],"class_list":["post-7498","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-closedby","tag-dialog","tag-html"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/10\/pexels-photo-1101720.jpeg?fit=1880%2C1253&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/7498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=7498"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/7498\/revisions"}],"predecessor-version":[{"id":7501,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/7498\/revisions\/7501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/7500"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=7498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=7498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=7498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}