Skip to content

feat: add destination-labeled back button to Employee OnboardingExecutionFlow#2033

Draft
aaronlee777 wants to merge 3 commits into
mainfrom
al/feat/ee-onboarding-back-button-state-machine
Draft

feat: add destination-labeled back button to Employee OnboardingExecutionFlow#2033
aaronlee777 wants to merge 3 commits into
mainfrom
al/feat/ee-onboarding-back-button-state-machine

Conversation

@aaronlee777

Copy link
Copy Markdown
Contributor

Summary

Adds a secondary back button above each step of the Employee onboarding execution flow. The label names the previous step (e.g. "Basic details" on Compensation, "Compensation" on Federal taxes) so users can orient themselves before clicking. The button is hidden on the initial profile step and on the final summary step.

When OnboardingExecutionFlow is rendered inside OnboardingFlow (the wrapper that owns the EmployeeList), the parent supplies an initialBackHeader so step one shows a "Back to employees" affordance and the user can exit the sub-flow at any time.

Changes

  • New state-machine back-edges in onboardingExecutionStateMachine.ts mirroring the forward graph; deductions has a guarded fork that mirrors the self-onboarding path.
  • New componentEvents.EMPLOYEE_ONBOARDING_BACK so the back event doesn't collide with CANCEL bubbling.
  • New initialBackHeader prop on OnboardingExecutionFlow + initialHeader context field so the first-step header survives navigation back to it.
  • New translations namespace Employee.OnboardingExecutionFlow with flat step-label keys + useI18n registration at the flow root.
  • Extracted createBackHeaderFactory to src/components/Flow/useFlow.ts and documented the pattern in src/components/Flow/README.md so Company Onboarding (and any future linear flow) can adopt it cheaply.
  • Fixed a stale-namespace bug in FlowHeader: useTranslation(ns) caches the namespace on first render and doesn't re-bind when the prop changes between steps. Switched to useTranslation() + per-call t(key, { ns }).

Demo

Related

Testing

  • npm run test -- --run src/components/Employee/OnboardingExecutionFlow src/components/Employee/OnboardingFlow src/components/Flow — 48 tests pass, including 22 new state-machine tests covering destination labels, the guarded deductions back fork, and the initialHeader preservation across BACK.
  • Manual: walk forward through the onboarding flow in the SDK dev app and confirm the back button on each step reads the previous step's name. From step one, click "Back to employees" and confirm it returns to the EmployeeList. Click back from Compensation → Profile; the parent's "Back to employees" header should re-appear.
  • npx tsc --noEmit — clean.

🤖 Generated with Claude Code

@aaronlee777 aaronlee777 force-pushed the al/feat/ee-onboarding-back-button-state-machine branch from dbe0477 to c299310 Compare June 5, 2026 17:08

@serikjensen serikjensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good first draft! i think we may need to further consider how back navigation can exist with breadcrumbs, progress indicator. Ironing out those cases would be a good candidate for design to implement in the sandbox

For the implementation, i think this is likely one we just need to ticket for the dev team. The biggest thing i'm thinking about is how to get back navigation working when you have nested flows. Ex. payroll execution flow is embedded in payroll flow. employee onboarding flow is nested inside of company onboarding flow.

Comment thread src/components/Flow/README.md Outdated
aaronlee777 and others added 2 commits June 17, 2026 13:50
…tionFlow

Add a secondary back button above each step of the Employee onboarding
execution flow. The label names the previous step (e.g. "Basic details"
on Compensation, "Compensation" on Federal taxes) so users can orient
themselves before navigating. Includes a parent-supplied
initialBackHeader prop so the first step can expose a "Back to
employees" affordance when nested in OnboardingFlow.

Extracts createBackHeaderFactory in src/components/Flow/useFlow.ts and
documents the conventions (per-flow back event, per-flow translation
namespace, destination-labeled headers) in src/components/Flow/README.md
so the same pattern can be applied to other linear flows.

Also fixes a stale-namespace bug in FlowHeader where useTranslation(ns)
caches the namespace on first render and does not re-bind when the
namespace prop changes between steps — switched to per-call
t(key, { ns }) so multi-namespace flows resolve correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ionFlow steps

Decomposes FlowHeaderConfig into independent back/cta/indicator axes so the
progress bar coexists with the destination-labeled back button on every step
(profile through employeeDocuments). Total step count adapts to onboarding
status (self vs full path) and withEmployeeI9. When nested inside
OnboardingFlow, the parent's "Back to employees" affordance is preserved on
step 1 alongside the progress bar via a new initialBack ctx field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aaronlee777 aaronlee777 force-pushed the al/feat/ee-onboarding-back-button-state-machine branch from c299310 to 0c05974 Compare June 17, 2026 17:55
@aaronlee777 aaronlee777 requested a review from serikjensen June 17, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants