Skip to content

Commit 6b576f2

Browse files
nmergetmfranzke
andauthored
fix: issue with empty aria-describedby (#4610)
* fix: issue with empty aria-describedby * test: updated snapshot * test: updated snapshot --------- Co-authored-by: Maximilian Franzke <[email protected]> Co-authored-by: Maximilian Franzke <[email protected]>
1 parent b2b504e commit 6b576f2

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

packages/components/src/components/checkbox/checkbox.lite.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
5353
_validMessageId: undefined,
5454
_invalidMessageId: undefined,
5555
_invalidMessage: undefined,
56-
_descByIds: '',
56+
_descByIds: undefined,
5757
_voiceOverFallback: '',
5858
hasValidState: () => {
5959
return !!(props.validMessage ?? props.validation === 'valid');
@@ -84,7 +84,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
8484
} else if (stringPropVisible(props.message, props.showMessage)) {
8585
state._descByIds = state._messageId;
8686
} else {
87-
state._descByIds = '';
87+
state._descByIds = undefined;
8888
}
8989
},
9090
handleChange: (event: ChangeEvent<HTMLInputElement>) => {
@@ -139,6 +139,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
139139
if (stringPropVisible(props.message, props.showMessage)) {
140140
state._descByIds = messageId;
141141
}
142+
state.handleValidation();
142143
}
143144
}, [state._id]);
144145

packages/components/src/components/custom-select/custom-select.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default function DBCustomSelect(props: DBCustomSelectProps) {
104104
_validity: 'no-validation',
105105
_userInteraction: false,
106106
// Workaround for Vue output: TS for Vue would think that it could be a function, and by this we clarify that it's a string
107-
_descByIds: '',
107+
_descByIds: undefined,
108108
_selectedLabels: '',
109109
_selectedLabelsId: undefined,
110110
_voiceOverFallback: '',

packages/components/src/components/input/input.lite.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export default function DBInput(props: DBInputProps) {
6767
_invalidMessageId: undefined,
6868
_invalidMessage: undefined,
6969
_dataListId: undefined,
70-
_descByIds: '',
71-
_value: '',
70+
_descByIds: undefined,
71+
_value: undefined,
7272
_voiceOverFallback: '',
7373
hasValidState: () => {
7474
return !!(props.validMessage ?? props.validation === 'valid');
@@ -102,7 +102,7 @@ export default function DBInput(props: DBInputProps) {
102102
} else if (stringPropVisible(props.message, props.showMessage)) {
103103
state._descByIds = state._messageId;
104104
} else {
105-
state._descByIds = '';
105+
state._descByIds = undefined;
106106
}
107107
},
108108
handleInput: (event: InputEvent<HTMLInputElement>) => {
@@ -192,6 +192,8 @@ export default function DBInput(props: DBInputProps) {
192192
if (stringPropVisible(props.message, props.showMessage)) {
193193
state._descByIds = messageId;
194194
}
195+
196+
state.handleValidation();
195197
}
196198
}, [state._id]);
197199

packages/components/src/components/select/select.lite.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function DBSelect(props: DBSelectProps) {
6363
_invalidMessage: undefined,
6464
_placeholderId: '',
6565
// Workaround for Vue output: TS for Vue would think that it could be a function, and by this we clarify that it's a string
66-
_descByIds: '',
66+
_descByIds: undefined,
6767
_value: '',
6868
initialized: false,
6969
_voiceOverFallback: '',
@@ -187,6 +187,7 @@ export default function DBSelect(props: DBSelectProps) {
187187
state._descByIds = placeholderId;
188188
}
189189

190+
state.handleValidation();
190191
state.initialized = false;
191192
}
192193
}, [state._id, state.initialized]);

packages/components/src/components/textarea/textarea.lite.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function DBTextarea(props: DBTextareaProps) {
5656
_invalidMessageId: undefined,
5757
_invalidMessage: undefined,
5858
// Workaround for Vue output: TS for Vue would think that it could be a function, and by this we clarify that it's a string
59-
_descByIds: '',
59+
_descByIds: undefined,
6060
_value: '',
6161
_voiceOverFallback: '',
6262
hasValidState: () => {
@@ -88,7 +88,7 @@ export default function DBTextarea(props: DBTextareaProps) {
8888
} else if (stringPropVisible(props.message, props.showMessage)) {
8989
state._descByIds = state._messageId;
9090
} else {
91-
state._descByIds = '';
91+
state._descByIds = undefined;
9292
}
9393
},
9494
handleInput: (event: InputEvent<HTMLTextAreaElement>) => {
@@ -162,6 +162,7 @@ export default function DBTextarea(props: DBTextareaProps) {
162162
if (stringPropVisible(props.message, props.showMessage)) {
163163
state._descByIds = messageId;
164164
}
165+
state.handleValidation();
165166
}
166167
}, [state._id]);
167168

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["Label, edit, required, True, blank","T. e. s. t","Test selected","blank. Please fill out this field.. unselected","T. e. s. t"]
1+
["Label, edit, required, Please fill out this field., True, blank","T. e. s. t","Test selected","blank. Please fill out this field.. unselected","T. e. s. t"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["Label, edit, required, multi line, True, blank","T. e. s. t","Test selected","blank. Please fill out this field.. unselected","T. e. s. t"]
1+
["Label, edit, required, multi line, Please fill out this field., True, blank","T. e. s. t","Test selected","blank. Please fill out this field.. unselected","T. e. s. t"]

0 commit comments

Comments
 (0)