Question presented to candidate: "Our sign-up form is too long for one screen. Split it into a wizard: Account (email and password), Profile (full name and plan), then a Review screen where people can jump back to edit before they create the account. Each step should only let you continue when that step is valid."
Requirements:
- Three steps: Account, Profile, Review. A step list and a progress bar show where the user is ("Step 2 of 3: Profile").
- Next validates only the current step; on failure it shows that step's errors and focuses the first invalid field.
- Back never validates and never loses data; Review shows everything entered (password masked) with Edit links that jump to a step.
- Create account calls a simulated API, disables the button while pending, then shows a success message.
- When the step changes, keyboard and screen-reader users land at the new step heading.
What a strong answer should cover:
- One centralized data object for the whole wizard, not one state per step, so Back and Edit are free.
- A step config (id, title, fields, validate) so step gating is generic, and progress is derived from the step index.
- Validation per step, with errors revealed only after Next was attempted on that step.
- Focus management on step change,
aria-current="step"on the step list and arole="progressbar"witharia-valuenow. - Submitting from the last step only, with Enter behaving like Next on earlier steps.
Clarifying questions expected:
- "Can users jump ahead to a later step, or only go back?"
- "Should progress survive a page reload?"
- "Does the server validate again at the end, and how do its errors map back to a step?"
Code / implementation expected: Yes. A wizard component driven by a step config, with per-step validation, progress, review with edit, and a simulated submit.