Interactive Elements

closedby="closerequest"

Allows platform close requests such as Escape and explicit close actions, but not outside-click light dismissal. A modal dialog with no valid closedby value normally behaves this way. On dialog; missing or invalid defaults to auto, whose effective behavior depends on modal versus nonmodal opening. Check support independently from dialog itself.

Formal Syntax & Structure

html syntaxhtml
closedby="closerequest"

Parameters & Attributes

NameTypeDescription
closedbykeywordAllows platform close requests such as Escape and explicit close actions, but not outside-click light dismissal. A modal dialog with no valid closedby value normally behaves this way.

Working Example

Example Snippethtml
<button id="launch">Open dialog</button><dialog id="notice" closedby="closerequest" aria-labelledby="heading">  <h2 id="heading">Notice</h2>  <form method="dialog">    <button>Close</button>  </form></dialog><script>  document.getElementById("launch").addEventListener("click",()=>document.getElementById("notice").showModal());</script>
HTML Reference