Give the window one short job

Imagine a Budapest acoustic-panel supplier whose website lets customers choose a material sample while preparing an enquiry. The current choice is grey felt. A customer opens the sample selector, tries blue and decides against it. Cancel should leave grey in the enquiry; Apply sample should replace it with blue. Neither action sends the enquiry.

A modal dialog temporarily blocks work on the page behind it. This can suit a brief, self-contained selection. If customers need to compare detailed panel specifications while choosing, keep the controls on the page or use a dedicated step. Saving space is less useful when the window hides information needed for the decision.

Define every way out before approving the design

For this selector, specify Apply sample as the only action that copies the proposed choice into the enquiry. Cancel, the close control and Escape discard that proposed change. Reopening starts from the applied choice. Other enquiry fields remain untouched. State this briefly beside the controls so customers know what will happen.

Decide separately whether tapping outside dismisses the window. If enabled, give it the same cancellation result; never treat an accidental outside tap as Apply. If disabled, retain an obvious close control. Cancellation must also work if required fields are incomplete. Ask the developer to demonstrate each exit separately, rather than relying on one shared closing animation.

Make entering and leaving predictable

W3C’s modal pattern moves keyboard focus inside, keeps Tab navigation there, supports Escape, and usually returns focus to the opener. Specify a sensible destination if that opener disappears.

Give the selector a meaningful title that screen readers can identify. Choose initial focus to suit the task: opening should help the customer understand the choice, not unexpectedly apply it. In this example, returning to Choose sample lets someone inspect the updated selection and continue their enquiry without hunting through the page.

Approve behaviour on a phone, not just a desktop image

MDN describes native HTML dialogs with built-in modal behaviour, but the opening mode matters. A styled floating box alone does not provide equivalent behaviour. Ask which component is used and test the finished workflow.

Try long translated material names, larger text and a short phone viewport. If the design adds a text field, test with the on-screen keyboard open. Keep the final option, explanation and exit controls reachable. W3C’s minimum focus-obscuring guidance addresses focused controls being entirely hidden by page content; aim to keep them clearly visible, including above any fixed button bar.

Use a repeatable acceptance walkthrough

Write down the expected selection after each action and review it in the supported browsers. Use this sequence before accepting the component:

  • Open from grey, select blue, cancel and reopen: grey remains selected.
  • Apply blue, then reopen: blue is selected and the enquiry is still unsent.
  • Repeat cancellation through the close control, Escape and any enabled outside-tap route.
  • Use keyboard and screen reader controls; check entry, exit and the return destination.
  • Try interacting with the background while the modal is open; it must stay unavailable.
  • Test long labels and an enlarged mobile layout; reach the last option and both action buttons.

Sources and further reading

← Back to Insights