An edge-aligned native dialog for reviewing or editing a record beside its surrounding workflow. Drawer extends the existing QDS dialog behavior: it shares modal focus, scroll locking, dismissal, async actions and lifecycle cleanup. No new framework, animation engine or token value is introduced.
Nested suggestions consume Escape before their parent drawer. In nonmodal mode, Escape also respects IME composition and controls that prevent its default action; the innermost dialog owns dismissal. Modal focus trapping is unchanged.
<script type="module" src="/assets/components/drawer/qds-drawer.js"></script>
<button id="review" type="button">Review opportunity</button>
<qds-drawer id="details" label="Review Cedar Crossing" placement="end" size="md">
<p>Opportunity summary and editable fields.</p>
<button slot="footer" type="button" onclick="document.getElementById('details').close('cancel')">Cancel</button>
</qds-drawer>
<script>
customElements.whenDefined('qds-drawer').then(() => {
const review = document.getElementById('review');
review.addEventListener('click', () => document.getElementById('details').show(review));
});
</script>
| Property / attribute | Default | Meaning |
|---|---|---|
| open | false | Opens on connection or property/attribute change. show(invoker) can record an explicit invoker. |
| label | Dialog | Visible title and accessible name fallback. Supply a meaningful business title. |
| placement | end | start/end follow text direction; left/right are physical; top/bottom are horizontal panels. |
| size | md | sm 20rem, md 32rem, lg 48rem, full viewport. Extent always clamps to viewport. |
| nonmodal | false | Keep surrounding content interactive without modal focus trapping or scroll locking. |
| no-escape | false | Refuse Escape dismissal. Provide a visible way to close. |
| close-on-backdrop | false | A pointer gesture starting and ending on the modal backdrop requests closure. |
| hide-close | false | Hide the close button; provide a footer dismissal action. |
| busy | false | Busy semantics and blocked user dismissal, managed by runAction where appropriate. |
| scroll | body | body keeps header/footer visible; dialog scrolls the whole panel. |
| initialFocus property | null | Optional focus target inside the drawer; otherwise the title receives focus. |
| returnFocus property | null | Logical focus destination on close; otherwise remembered invoker. |
| returnValue property | empty | Result of the most recent close. |
Invalid placement/size values fall back to end/md. Defaults do not change text direction. Changes to placement/size preserve projected content, values and focus. Pre-upgrade properties are honored. Removing an open drawer closes it, aborts its pending action, releases scroll locking and removes document listeners.
Reasons: api, escape, backdrop, close-button, action, attribute, native and disconnect. Business validation and persistence remain application concerns.
Modal drawers use native showModal, contain Tab/Shift+Tab in the composed focus scope, make underlying content inert and reference-count scroll locking. Escape closes the top modal unless protected/busy/canceled. Focus returns to an explicit return target or the remembered invoker when available. Pass an explicit invoker for pointer platforms that do not focus buttons automatically.
Nonmodal drawers use native show, allow normal Tab navigation back to the page, and close on Escape only while focus is within the drawer. Keep their trigger reachable and provide a close action so users can move between the panel and surrounding work. Dialog, menus, popovers and native/QDS fields can be composed inside. Test both nested dialog directions and mixed standalone/catalog imports.
References: WAI dialog pattern, HTML dialog.
Northwind Investments > Pipeline exposes quick review actions for its seeded opportunities. The generated drawer exposes show/close methods and close events; editing a stage and saving updates the fixture row and a visible status. Cancel/Escape leaves the record unchanged. The review query parameter identifies the open record for links/reload. Changes are local to this screen and reset on leaving or reloading; opening the full opportunity remains available in the footer.