diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index 4b99eeb3..0ffdccf0 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -261,7 +261,7 @@ open class TextArea: EntryFieldBase { open func highlightCharacterOverflow() { let count = textView.text.count - guard let maxLength, count > maxLength else { + guard let maxLength, maxLength > 0, count > maxLength else { textView.textAttributes = nil return } @@ -327,12 +327,11 @@ extension TextArea: UITextViewDelegate { //The exceeding characters will be highlighted to help users correct their entry. if ((maxLength ?? 0) > 0) { if textView.text.count <= allowCharCount { + highlightCharacterOverflow() + //setting the value and firing control event value = textView.text sendActions(for: .valueChanged) - if (textView.text.count > (maxLength ?? 0)) { - highlightCharacterOverflow() - } } else { textView.text.removeLast() highlightCharacterOverflow() @@ -343,6 +342,7 @@ extension TextArea: UITextViewDelegate { sendActions(for: .valueChanged) } } + } /// Will move this into a new file, need to talk with Scott/Kyle