Frontend School

Configure Workflow Step Dialog

Machine Coding
medium

Configure Workflow Step Dialog

Medium
React
UI
Modal
Accessibility
Forms

Overview

Atlassian products often involve complex workflows to manage tasks, issues, and projects. Users frequently need to configure individual steps within these workflows to align with their specific processes. This problem focuses on building a robust and accessible modal dialog that allows users to configure the properties of a WorkflowStep.

Building such a dialog is critical for providing a seamless user experience, ensuring data integrity, and allowing users to customize their workflows effectively. It tests your ability to manage UI state, handle user input, and implement essential accessibility features for interactive components.

What you need to do / Task

Your primary task is to implement the WorkflowStepConfigDialog component and integrate it into the provided App component. The dialog should facilitate the configuration of a WorkflowStep object.

  1. Implement WorkflowStepConfigDialog: Complete the WorkflowStepConfigDialog component to display and allow editing of WorkflowStep properties.
  2. Display Initial Data: When the dialog opens, its form fields should be pre-populated with the initialConfig provided via props.
  3. Enable Editing: Allow users to modify at least two properties of the WorkflowStep:
    • name (via a text input).
    • assigneeType (via a dropdown/select input with options: INDIVIDUAL, ROLE, UNASSIGNED).
  4. Save and Cancel Actions: The dialog must include:
    • A "Save" button: When clicked, it should call the onSave prop with the updated WorkflowStep configuration and then close the dialog.
    • A "Cancel" button: When clicked, it should close the dialog without applying any changes to the WorkflowStep.

UI/UX expectations

  • Modal Presentation: The dialog should appear centered on the screen, overlaying the main content, with a semi-transparent background. It should have a clear title, "Configure Workflow Step".
  • Form Elements: Use appropriate HTML form elements (<input type="text">, <select>) for editing the properties.
  • Button Styling: "Save" should appear as a primary action (e.g., blue background), and "Cancel" as a secondary action (e.g., ghost or neutral background).
  • Accessibility:
    • Pressing the Esc key should close the dialog.
    • Focus should be trapped within the modal when it is open, meaning Tab key presses should cycle focus only through elements inside the dialog.
    • Clicking outside the modal should not close it, as this is a critical configuration dialog.

Acceptance criteria

  • The "Configure Step" button correctly opens the WorkflowStepConfigDialog.
  • Upon opening, the dialog's form fields (name, assigneeType) are pre-filled with the current WorkflowStep data from App's state.
  • Users can modify the name and assigneeType fields within the dialog.
  • Clicking the "Cancel" button closes the dialog and ensures the WorkflowStep in App's state remains unchanged.
  • Clicking the "Save" button closes the dialog and updates the WorkflowStep in App's state with the new values from the form.
  • The dialog visually overlays the main content, is centered, and has a distinct background.
  • Pressing the Esc key closes the dialog.
  • When the dialog is open, pressing Tab cycles focus only among interactive elements within the dialog; focus does not escape to the main page content.

Constraints

Constraints & assumptions

  • You must use React for building the UI component.
  • No external UI component libraries (e.g., Atlassian's AtlasKit, Material UI, Ant Design) are allowed; build components using basic HTML elements and CSS.
  • Basic styling is provided in styles.css; focus on functionality and component structure rather than pixel-perfect styling.
  • Mock data for WorkflowStep is provided in App.tsx.
  • Assume a single WorkflowStep is being configured at a time.
  • The WorkflowStep interface and initial data are immutable for the purpose of the initialConfig prop; internal form state should manage changes before saving.

Out of scope

  • Complex form validation beyond basic HTML5 attributes (e.g., required).
  • Integration with a backend API or complex state management libraries (e.g., Redux, Zustand).
  • Comprehensive error handling or toast notifications.
  • Full internationalization (i18n).

What interviewers evaluate

  • Component Design: How well the WorkflowStepConfigDialog is encapsulated and how props are used for control and data flow.
  • React State Management: Effective and idiomatic use of React's useState and useEffect hooks for managing form and modal state.
  • Accessibility Implementation: Correct handling of keyboard interactions (Esc key, tab trapping) for modal dialogs.
  • Functional Correctness: The dialog correctly opens, closes, displays data, and updates parent state based on user actions.
  • Code Quality: Readability, maintainability, and adherence to modern React and TypeScript best practices.

Loading editor...