From 7953751a89a8088816fd71a2a2bf32acb0a14ab5 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 23 May 2024 11:59:13 -0500 Subject: [PATCH] fixed optional text position Signed-off-by: Matt Bruce --- VDS/Components/DropdownSelect/DropdownSelect.swift | 4 ++-- VDS/Components/TextFields/EntryFieldBase.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VDS/Components/DropdownSelect/DropdownSelect.swift b/VDS/Components/DropdownSelect/DropdownSelect.swift index cf3539fb..f596f725 100644 --- a/VDS/Components/DropdownSelect/DropdownSelect.swift +++ b/VDS/Components/DropdownSelect/DropdownSelect.swift @@ -222,11 +222,11 @@ open class DropdownSelect: EntryFieldBase { updatedLabelText = showInlineLabel ? "" : updatedLabelText if let oldText = updatedLabelText, !isRequired, !oldText.hasSuffix("Optional") { - let optionColorAttr = ColorLabelAttribute(location: oldText.count + 2, + let optionColorAttr = ColorLabelAttribute(location: oldText.count + 1, length: 8, color: secondaryColorConfiguration.getColor(self)) - updatedLabelText = showInlineLabel ? "Optional" : "\(oldText) Optional" + updatedLabelText = showInlineLabel ? "Optional" : "\(oldText) Optional" attributes.append(optionColorAttr) } diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 58328966..3f37205e 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -360,13 +360,13 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { //dealing with the "Optional" addition to the text if let oldText = updatedLabelText, !isRequired, !oldText.hasSuffix("Optional") { if isEnabled { - let optionColorAttr = ColorLabelAttribute(location: oldText.count + 2, + let optionColorAttr = ColorLabelAttribute(location: oldText.count + 1, length: 8, color: VDSColor.elementsSecondaryOnlight) attributes.append(optionColorAttr) } - updatedLabelText = "\(oldText) Optional" + updatedLabelText = "\(oldText) Optional" } if let tooltipModel {