diff --git a/README.md b/README.md
index 035a014..abcfac2 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ I did try doing everything myself, but faced issues around updating the form sta
Cons?
-- Some carousels like Alice behave unpredictably sometimes. So maybe don't use Alice.
+- Alice behaves a little unpredictably sometimes.
@@ -53,3 +53,7 @@ I did try doing everything myself, but faced issues around updating the form sta
Abso-fruitly!
+
+
+
+Compare against Swiper carousel [here](https://github.com/CHR-onicles/animated-stepper-form/tree/18-swiper-carousel#faqs-for-future-me)
diff --git a/src/components/CustomDatePicker/index.tsx b/src/components/CustomDatePicker/index.tsx
index 22f0aba..8974404 100644
--- a/src/components/CustomDatePicker/index.tsx
+++ b/src/components/CustomDatePicker/index.tsx
@@ -21,6 +21,7 @@ interface CustomDatePickerProps {
minDate?: Date;
showYearDropdown?: boolean;
required?: boolean;
+ tabIndex?: number;
}
export const CustomDatePicker = ({
@@ -36,18 +37,20 @@ export const CustomDatePicker = ({
minDate = new Date(1900, 0, 1),
showYearDropdown = false,
required = false,
+ tabIndex,
}: CustomDatePickerProps) => {
// console.log("[From Date picker]", startDate);
return (
{isInline ? null : }
{
diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx
index 1936690..c32a892 100644
--- a/src/pages/Home/index.tsx
+++ b/src/pages/Home/index.tsx
@@ -21,6 +21,12 @@ const responsive = {
const TOTAL_STEPS = steps.length;
+// Function to prevent users from tabbing into another step without finishing
+// the current step
+const getTabIndex = (currentStep: number, validStep: number) => {
+ return currentStep === validStep ? 0 : -1;
+};
+
export const Home = () => {
const [dob, setDob] = useState();
const [step, setStep] = useState(1);
@@ -67,6 +73,7 @@ export const Home = () => {
id="fullName"
value={formData.fullName ?? ""}
onChange={handleOnChange}
+ tabIndex={getTabIndex(step, 1)}
/>
@@ -81,6 +88,7 @@ export const Home = () => {
placeholder="Select a date"
showYearDropdown
required
+ tabIndex={getTabIndex(step, 1)}
/>
@@ -96,12 +104,13 @@ export const Home = () => {
value={formData.email ?? ""}
onChange={handleOnChange}
required
+ tabIndex={getTabIndex(step, 1)}
/>
,
,
,
];