Skip to content

Commit 85ec2f5

Browse files
authored
Merge pull request Expensify#84872 from Expensify/claude-fixAngleBracketTaxValidation
Fix: Enable strict HTML tag validation on tax name forms
2 parents 81b04d8 + b5baee7 commit 85ec2f5

6 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/components/TextPicker/TextSelectorModal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function TextSelectorModal({
3333
customValidate,
3434
enabledWhenOffline = true,
3535
allowHTML,
36+
shouldUseStrictHtmlTagValidation = false,
3637
autoGrowHeight,
3738
...rest
3839
}: TextSelectorModalProps) {
@@ -164,6 +165,7 @@ function TextSelectorModal({
164165
addBottomSafeAreaPadding
165166
enterKeyEventListenerPriority={0}
166167
allowHTML={allowHTML}
168+
shouldUseStrictHtmlTagValidation={shouldUseStrictHtmlTagValidation}
167169
shouldValidateOnBlur={!isClosing}
168170
>
169171
{!!subtitle && (

src/components/TextPicker/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function TextPicker({
2020
interactive = true,
2121
required = false,
2222
customValidate,
23+
shouldUseStrictHtmlTagValidation,
2324
wrapperStyle,
2425
numberOfLinesTitle,
2526
titleStyle,
@@ -80,6 +81,7 @@ function TextPicker({
8081
disabled={disabled}
8182
required={required}
8283
customValidate={customValidate}
84+
shouldUseStrictHtmlTagValidation={shouldUseStrictHtmlTagValidation}
8385
// eslint-disable-next-line react/jsx-props-no-spreading
8486
{...rest}
8587
/>

src/components/TextPicker/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ type TextSelectorModalProps = {
3838

3939
/** Whether HTML is allowed in form inputs */
4040
allowHTML?: boolean;
41+
42+
/** Whether to use strict HTML tag validation regex */
43+
shouldUseStrictHtmlTagValidation?: boolean;
4144
} & Pick<MenuItemBaseProps, 'subtitle' | 'description'> &
4245
Omit<TextProps, 'ref'>;
4346

@@ -81,6 +84,9 @@ type TextPickerProps = {
8184
/** Whether HTML is allowed in form inputs */
8285
allowHTML?: boolean;
8386

87+
/** Whether to use strict HTML tag validation regex */
88+
shouldUseStrictHtmlTagValidation?: boolean;
89+
8490
/** Reference to the outer element */
8591
ref?: ForwardedRef<View>;
8692
} & Pick<MenuItemBaseProps, 'rightLabel' | 'subtitle' | 'description' | 'interactive' | 'wrapperStyle' | 'numberOfLinesTitle' | 'titleStyle' | 'descriptionTextStyle'> &

src/pages/workspace/reports/CreateReportFieldsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ function WorkspaceCreateReportFieldsPage({
182182
enabledWhenOffline
183183
shouldValidateOnBlur={false}
184184
addBottomSafeAreaPadding
185+
shouldUseStrictHtmlTagValidation
185186
>
186187
{({inputValues}) => (
187188
<View style={styles.mhn5}>
@@ -198,6 +199,7 @@ function WorkspaceCreateReportFieldsPage({
198199
role={CONST.ROLE.PRESENTATION}
199200
required
200201
customValidate={validateName}
202+
shouldUseStrictHtmlTagValidation
201203
/>
202204
<InputWrapper
203205
InputComponent={TypeSelector}

src/pages/workspace/taxes/NamePage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ function NamePage({
9292
validate={validate}
9393
shouldHideFixErrorsAlert
9494
addBottomSafeAreaPadding
95+
shouldUseStrictHtmlTagValidation
9596
>
9697
<View style={styles.mb4}>
9798
<InputWrapper

src/pages/workspace/taxes/WorkspaceCreateTaxPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function WorkspaceCreateTaxPage({
9898
enabledWhenOffline
9999
shouldValidateOnBlur={false}
100100
addBottomSafeAreaPadding
101+
shouldUseStrictHtmlTagValidation
101102
>
102103
<View style={styles.mhn5}>
103104
<InputWrapper
@@ -112,6 +113,7 @@ function WorkspaceCreateTaxPage({
112113
role={CONST.ROLE.PRESENTATION}
113114
required
114115
customValidate={customValidateForName}
116+
shouldUseStrictHtmlTagValidation
115117
/>
116118
<InputWrapper
117119
InputComponent={AmountPicker}

0 commit comments

Comments
 (0)