diff --git a/app/src/pathways/report/components/PolicyParameterSelectorValueSetter.tsx b/app/src/pathways/report/components/PolicyParameterSelectorValueSetter.tsx
index 865feafa0..86a6328f7 100644
--- a/app/src/pathways/report/components/PolicyParameterSelectorValueSetter.tsx
+++ b/app/src/pathways/report/components/PolicyParameterSelectorValueSetter.tsx
@@ -74,6 +74,7 @@ export default function PolicyParameterSelectorValueSetter({
setStartDate,
endDate,
setEndDate,
+ onEnter: handleSubmit,
};
return (
diff --git a/app/src/pathways/report/components/valueSetters/DateValueSelector.tsx b/app/src/pathways/report/components/valueSetters/DateValueSelector.tsx
index b94e895a3..98de48186 100644
--- a/app/src/pathways/report/components/valueSetters/DateValueSelector.tsx
+++ b/app/src/pathways/report/components/valueSetters/DateValueSelector.tsx
@@ -18,6 +18,7 @@ export function DateValueSelector(props: ValueSetterProps) {
setStartDate,
endDate,
setEndDate,
+ onEnter,
} = props;
// Local state for param value
@@ -87,7 +88,7 @@ export function DateValueSelector(props: ValueSetterProps) {
onChange={handleEndDateChange}
/>
-
+
);
}
diff --git a/app/src/pathways/report/components/valueSetters/DefaultValueSelector.tsx b/app/src/pathways/report/components/valueSetters/DefaultValueSelector.tsx
index 0cb2daf8b..b57ecc817 100644
--- a/app/src/pathways/report/components/valueSetters/DefaultValueSelector.tsx
+++ b/app/src/pathways/report/components/valueSetters/DefaultValueSelector.tsx
@@ -18,6 +18,7 @@ export function DefaultValueSelector(props: ValueSetterProps) {
setStartDate,
endDate,
setEndDate,
+ onEnter,
} = props;
// Local state for param value
@@ -80,7 +81,12 @@ export function DefaultValueSelector(props: ValueSetterProps) {
onward:
-
+
);
diff --git a/app/src/pathways/report/components/valueSetters/MultiYearValueSelector.tsx b/app/src/pathways/report/components/valueSetters/MultiYearValueSelector.tsx
index d3ad78e1c..a3ee24a87 100644
--- a/app/src/pathways/report/components/valueSetters/MultiYearValueSelector.tsx
+++ b/app/src/pathways/report/components/valueSetters/MultiYearValueSelector.tsx
@@ -10,7 +10,7 @@ import { ValueInputBox } from './ValueInputBox';
import { ValueSetterProps } from './ValueSetterProps';
export function MultiYearValueSelector(props: ValueSetterProps) {
- const { param, policy, setIntervals } = props;
+ const { param, policy, setIntervals, onEnter } = props;
// Get available years from metadata
const availableYears = useSelector(getTaxYears);
@@ -87,6 +87,7 @@ export function MultiYearValueSelector(props: ValueSetterProps) {
param={param}
value={yearValues[year]}
onChange={(value) => handleYearValueChange(year, value)}
+ onEnter={onEnter}
/>
))}
@@ -101,6 +102,7 @@ export function MultiYearValueSelector(props: ValueSetterProps) {
param={param}
value={yearValues[year]}
onChange={(value) => handleYearValueChange(year, value)}
+ onEnter={onEnter}
/>
))}
diff --git a/app/src/pathways/report/components/valueSetters/ValueInputBox.tsx b/app/src/pathways/report/components/valueSetters/ValueInputBox.tsx
index 2a747d64a..6b1f6a688 100644
--- a/app/src/pathways/report/components/valueSetters/ValueInputBox.tsx
+++ b/app/src/pathways/report/components/valueSetters/ValueInputBox.tsx
@@ -9,10 +9,11 @@ interface ValueInputBoxProps {
param: ParameterMetadata;
value?: any;
onChange?: (value: any) => void;
+ onEnter?: () => void;
}
export function ValueInputBox(props: ValueInputBoxProps) {
- const { param, value, onChange, label } = props;
+ const { param, value, onChange, onEnter, label } = props;
// US and UK packages use these type designations inconsistently
const USD_UNITS = ['currency-USD', 'currency_USD', 'USD'];
@@ -98,6 +99,12 @@ export function ValueInputBox(props: ValueInputBoxProps) {
value={displayValue}
onChange={handleChange}
className={cn(prefix ? 'tw:pl-7' : '', isPercentage ? 'tw:pr-7' : '')}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter') {
+ event.preventDefault();
+ onEnter?.();
+ }
+ }}
style={{ flex: 1 }}
/>
{isPercentage && (
diff --git a/app/src/pathways/report/components/valueSetters/ValueSetterProps.ts b/app/src/pathways/report/components/valueSetters/ValueSetterProps.ts
index 50d96a96e..615aa9462 100644
--- a/app/src/pathways/report/components/valueSetters/ValueSetterProps.ts
+++ b/app/src/pathways/report/components/valueSetters/ValueSetterProps.ts
@@ -14,4 +14,5 @@ export interface ValueSetterProps {
setStartDate: Dispatch>;
endDate: string;
setEndDate: Dispatch>;
+ onEnter?: () => void;
}
diff --git a/app/src/pathways/report/components/valueSetters/YearlyValueSelector.tsx b/app/src/pathways/report/components/valueSetters/YearlyValueSelector.tsx
index 402b0a150..b5baa7076 100644
--- a/app/src/pathways/report/components/valueSetters/YearlyValueSelector.tsx
+++ b/app/src/pathways/report/components/valueSetters/YearlyValueSelector.tsx
@@ -18,6 +18,7 @@ export function YearlyValueSelector(props: ValueSetterProps) {
setStartDate,
endDate,
setEndDate,
+ onEnter,
} = props;
// Local state for param value
@@ -99,7 +100,7 @@ export function YearlyValueSelector(props: ValueSetterProps) {
onChange={handleEndYearChange}
/>
-
+
);
}