From 9135dc03e450f387071e28ff367c9904604a9d8f Mon Sep 17 00:00:00 2001 From: Nicolas Merget Date: Thu, 12 Dec 2024 11:46:58 +0100 Subject: [PATCH] fix: issues for form-components using showMessage --- packages/components/src/components/checkbox/checkbox.lite.tsx | 4 ++-- packages/components/src/components/input/input.lite.tsx | 4 ++-- packages/components/src/components/select/select.lite.tsx | 4 ++-- packages/components/src/components/textarea/textarea.lite.tsx | 4 ++-- showcases/shared/select.json | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/components/src/components/checkbox/checkbox.lite.tsx b/packages/components/src/components/checkbox/checkbox.lite.tsx index 9f9c968ded9..4bdafce9d35 100644 --- a/packages/components/src/components/checkbox/checkbox.lite.tsx +++ b/packages/components/src/components/checkbox/checkbox.lite.tsx @@ -81,7 +81,7 @@ export default function DBCheckbox(props: DBCheckboxProps) { props.validMessage ?? DEFAULT_VALID_MESSAGE; delay(() => (state._voiceOverFallback = ''), 1000); } - } else if (props.message) { + } else if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = state._messageId; } else { state._descByIds = ''; @@ -124,7 +124,7 @@ export default function DBCheckbox(props: DBCheckboxProps) { state._invalidMessageId = state._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX; - if (props.message) { + if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = messageId; } } diff --git a/packages/components/src/components/input/input.lite.tsx b/packages/components/src/components/input/input.lite.tsx index 0f16e40c15f..f794e89c77f 100644 --- a/packages/components/src/components/input/input.lite.tsx +++ b/packages/components/src/components/input/input.lite.tsx @@ -105,7 +105,7 @@ export default function DBInput(props: DBInputProps) { props.validMessage ?? DEFAULT_VALID_MESSAGE; delay(() => (state._voiceOverFallback = ''), 1000); } - } else if (props.message) { + } else if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = state._messageId; } else { state._descByIds = ''; @@ -162,7 +162,7 @@ export default function DBInput(props: DBInputProps) { state._dataListId = props.dataListId ?? state._id + DEFAULT_DATALIST_ID_SUFFIX; - if (props.message) { + if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = messageId; } } diff --git a/packages/components/src/components/select/select.lite.tsx b/packages/components/src/components/select/select.lite.tsx index 192fc2812fa..1af3d6b9ce2 100644 --- a/packages/components/src/components/select/select.lite.tsx +++ b/packages/components/src/components/select/select.lite.tsx @@ -106,7 +106,7 @@ export default function DBSelect(props: DBSelectProps) { props.validMessage ?? DEFAULT_VALID_MESSAGE; delay(() => (state._voiceOverFallback = ''), 1000); } - } else if (props.message) { + } else if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = state._messageId; } else { state._descByIds = state._placeholderId; @@ -155,7 +155,7 @@ export default function DBSelect(props: DBSelectProps) { state._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX; state._placeholderId = placeholderId; - if (props.message) { + if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = messageId; } else { state._descByIds = placeholderId; diff --git a/packages/components/src/components/textarea/textarea.lite.tsx b/packages/components/src/components/textarea/textarea.lite.tsx index 19c939f7c0c..ef67cd62f81 100644 --- a/packages/components/src/components/textarea/textarea.lite.tsx +++ b/packages/components/src/components/textarea/textarea.lite.tsx @@ -88,7 +88,7 @@ export default function DBTextarea(props: DBTextareaProps) { props.validMessage ?? DEFAULT_VALID_MESSAGE; delay(() => (state._voiceOverFallback = ''), 1000); } - } else if (props.message) { + } else if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = state._messageId; } else { state._descByIds = ''; @@ -130,7 +130,7 @@ export default function DBTextarea(props: DBTextareaProps) { state._invalidMessageId = state._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX; - if (props.message) { + if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = messageId; } } diff --git a/showcases/shared/select.json b/showcases/shared/select.json index 7e50665b769..c6040021d6b 100644 --- a/showcases/shared/select.json +++ b/showcases/shared/select.json @@ -273,7 +273,8 @@ "props": { "options": [ { - "value": "Valid" + "value": "Valid", + "selected": true }, { "value": "Option 2"