From 251a7a1ce0bb3ce611e957d66e62a2d1d9432ce8 Mon Sep 17 00:00:00 2001 From: Alex Soloviev Date: Mon, 18 Nov 2024 12:21:42 -0700 Subject: [PATCH] reverte the backbutton behaviour and fixed a couple bugs --- components/Forms/CurrencyField.tsx | 14 ++++++---- components/Layout/index.tsx | 7 +++++ components/ResultsPage/YourAnswers.tsx | 7 +++-- components/StepperPage/index.tsx | 37 ++++---------------------- pages/index.tsx | 1 + pages/questions/index.tsx | 18 +------------ 6 files changed, 28 insertions(+), 56 deletions(-) diff --git a/components/Forms/CurrencyField.tsx b/components/Forms/CurrencyField.tsx index 632fae04f..b676efc61 100644 --- a/components/Forms/CurrencyField.tsx +++ b/components/Forms/CurrencyField.tsx @@ -1,13 +1,11 @@ -import { Error } from './Error' import { useRouter } from 'next/router' -import { useState, InputHTMLAttributes, useEffect } from 'react' +import { InputHTMLAttributes, useEffect, useState } from 'react' import NumberFormat from 'react-number-format' +import { TooltipTranslation } from '../../i18n/tooltips' import { Language } from '../../utils/api/definitions/enums' +import { Error } from './Error' import { QuestionLabel } from './QuestionLabel' -import { Tooltip } from '../Tooltip/tooltip' import { sanitizeCurrency } from './validation/utils' -import { set } from 'lodash' -import { TooltipTranslation } from '../../i18n/tooltips' export interface CurrencyFieldProps extends InputHTMLAttributes { @@ -119,6 +117,12 @@ export const CurrencyField: React.VFC = ({ aria-describedby={ locale === Language.EN ? `${name}-currency-symbol` : undefined } + isAllowed={(values) => { + const { formattedValue } = values + return !( + formattedValue.startsWith('.') || formattedValue.startsWith(',') + ) + }} /> {locale !== Language.EN && ( diff --git a/components/Layout/index.tsx b/components/Layout/index.tsx index b17ded998..826f3f47e 100644 --- a/components/Layout/index.tsx +++ b/components/Layout/index.tsx @@ -129,6 +129,13 @@ export const Layout: React.VFC<{ {/* */}
+
+ {/* Hidden focusable element */} +