Define shared modal shell and navigation
This commit is contained in:
1 parent
c3154e97d6
commit
38c83ad98e
3 files changed
+35
-1
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# Shared modal example
|
||||
|
||||
A shared component owns the header layout, close and backdrop behavior, busy
|
||||
state and navigation control placement. Each dialog provides only its title,
|
||||
body, available actions and optional wizard steps. The left and right navigation
|
||||
icons use the same icon family and have accessible labels.
|
||||
|
||||
```html
|
||||
<dialog class="modal" aria-labelledby="job-title">
|
||||
<div class="modal-head">
|
||||
<button type="button" data-modal-close aria-label="Close" title="Close">...</button>
|
||||
<button type="button" data-modal-navigation aria-label="Back" title="Back">...</button>
|
||||
<button type="button" data-modal-navigation aria-label="Next" title="Next">...</button>
|
||||
<h2 id="job-title">Backup job</h2>
|
||||
</div>
|
||||
<div class="modal-body">...</div>
|
||||
<div class="modal-foot"><button type="submit">Save</button></div>
|
||||
</dialog>
|
||||
```
|
||||
|
||||
The shared shell places close and navigation on the left and centers the title.
|
||||
The footer action is text only. A dialog without wizard steps omits navigation;
|
||||
its content and actions remain specific to that dialog.
|
||||
@@ -1,6 +1,6 @@
|
||||
# Contract: Modal Workflows
|
||||
|
||||
Version: 1.3
|
||||
Version: 1.4
|
||||
|
||||
## State Machine
|
||||
|
||||
@@ -20,6 +20,15 @@ closed → open → submitting → success | error
|
||||
|
||||
## Rules
|
||||
|
||||
- Use one shared modal shell and behavior for every modal. Individual dialogs
|
||||
supply their title, content and actions; they do not reimplement shell layout,
|
||||
dismissal, busy handling or wizard navigation controls.
|
||||
- Place the close control at the left of the header, as in macOS, and center
|
||||
the title in the modal. Place wizard back and next controls beside the close
|
||||
control, using a matching left/right icon pair. Keep primary and other header
|
||||
actions accessible without overlapping the title, including on narrow screens.
|
||||
- Modal footers contain no icon buttons. Where an action belongs in the footer,
|
||||
use a text-labelled button that states the action. Do not hide required actions.
|
||||
- Destructive actions (delete, archive, bulk remove) require a separate confirmation modal — not
|
||||
just a disabled button. Confirmation modal must name the target: "Delete component ABC-123?"
|
||||
- Never close a modal automatically on error — keep it open so the user can retry or copy the error.
|
||||
|
||||
@@ -78,6 +78,8 @@ Copy `assets/view.css` as the starting stylesheet and adapt tokens; do not rewri
|
||||
`title` and `aria-label`; do not put a text label next to the icon. Items of
|
||||
a popup menu (`role="menuitem"`) keep their text, because the menu has no
|
||||
other way to tell them apart.
|
||||
- Modal footer actions use text labels without icons; modal header controls
|
||||
follow the shared `modal-workflows` contract.
|
||||
- One icon means one action across the whole interface. Restore, refresh,
|
||||
restart, connection test and similar actions each get their own distinct icon;
|
||||
never reuse one icon for a different action. Keep the action-to-icon table in
|
||||
|
||||
Reference in new issue
Block a user