Feedback, progress and files

Make recovery persistent and distinguish local simulation from a real operation.

Inspect a local file

Only the name and size appear here. Your file stays on this device.

View markup
<div class="spec-stack"><div class="ex-field"><label class="ex-label" for="spec-file">Choose a file to inspect</label>
      <input id="spec-file" class="spec-file" type="file" aria-describedby="spec-file-hint">
      <p id="spec-file-hint" class="spec-muted">Only the name and size appear here. Your file stays on this device.</p></div>
      <p class="spec-status" role="status" data-status></p>
      <div class="spec-actions"><button type="button" class="ex-button ex-button--secondary" data-clear-file disabled>Clear selection</button></div>
    </div>
Usage and implementation

Full example

Open the full example

Use and alternatives

Use inline status for task progress, a banner for information affecting the current view and a brief notice for supplementary feedback. Keep an independent recovery route when a notice disappears. A native file picker is the default; drag and drop is an additional path.

Anatomy

One actual status message sits beside the task. Known status and button labels reserve their natural footprint with noninteractive aria-hidden sizing copies. The file field, help and summary are connected. The selected-file list has individual removal actions. Progress has a name; unknown progress has no fabricated value.

States and recovery

The simulated task covers ready, running, stalled, failed, cancelled and complete. Retry starts a new run; stale ticks cannot revive an old one. Per-file removal is disabled while work is active. The bounded FIFO notice queue retains persistent Restore actions even after all notices are dismissed.

Semantics and focus

Announce phase changes without narrating every percentage tick. After removal focus next, previous, then the file picker. Restore focuses the restored Remove action. Dismissing one notice preserves the mounted action when another is queued; dismissing the last moves to stable recovery content. Hidden naming text must actually be visually hidden within a positioned container.

Responsive and preferences

Shrink nested gutters before text or targets. At narrow enlarged widths, keep action padding proportionate so words remain readable. Explicit minmax(0, 1fr) grids and bounded native progress prevent min-content overflow in RTL. Test both left and right viewport edges, not only document width.

API and ownership

createTask/taskReducer/taskMessage describe a local state machine with run identifiers; createNotes/notesReducer provide bounded recovery notices. validateFileMetadata and LIMITS check reported local metadata: up to three files, five MiB each and ten MiB total in this example. The product must replace simulated timing with its actual operation and cancellation semantics.

Security and data

The example reads names, sizes and reported types; it does not read file contents, upload, store or scan files. Reported MIME and extensions cannot prove safety. A real upload requires server validation, authorization, safe storage and processing controls appropriate to its threat model. Cancel is not a promise of server rollback.

Acceptance

Exercise picker and drop through the same validator, invalid replacement→summary→picker, only/first/middle/last removal, cancel, failure/retry, stalled unknown→retry and late-event rejection. Dismiss a full queue and still restore every item. Real files/services, physical picker behavior, assistive technology and timing acceptance remain unverified.