import React from "react"; import type { ChoiceType } from "./multiple-choice-widget"; /** * Props for the MultipleChoiceComponent */ export interface MultipleChoiceComponentProps { choices: ReadonlyArray; countChoices: boolean | null | undefined; multipleSelect?: boolean; numCorrect: number; onChoiceChange: (choiceId: string, newCheckedState: boolean) => void; reviewMode: boolean; } /** * The MultipleChoiceComponent renders the UI for multiple choice questions. * * This component handles the presentation of choices, user interactions, * and accessibility features, while the MultipleChoiceWidget manages the * underlying logic and state. * * Supports both radio button (single select) and checkbox (multiple select) modes. * * NOTE: This widget does not implement standard radio button or checkbox elements. * The key difference is that the single-select (aka radio button) should * allow the user to deselect a choice, whereas regular radio buttons * can only be deselected by selecting another choice. * Another difference is that keyboard navigation with single-select is * done with the tab key, whereas regular radio buttons use the arrow keys, * and the radio buttons are automatically selected when navigating to them. * Since interactions with the single-select version of this widget don't * follow the standard radio button behavior, we decided to use toggle * button semantics for both versions of the widget, * and implement additional ARIA attributes where needed. * * NOTE: Redundant ARIA roles for