From 9aaeec22c92537c05b9931baf4af8f5079608776 Mon Sep 17 00:00:00 2001 From: Josh Bruce Date: Sun, 4 Oct 2026 16:52:32 -0400 Subject: [PATCH] refactor: Apply same single check to dropdown --- src/Forms/Select.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Forms/Select.php b/src/Forms/Select.php index 6ea2ebe..f2cd456 100644 --- a/src/Forms/Select.php +++ b/src/Forms/Select.php @@ -156,6 +156,8 @@ public function __toString(): string private function selectDropdown(): Element { $elements = []; + + $hasWarningMessage = (self::warningMessage() !== ''); foreach ($this->options as $value => $content) { $value = (string) $value; $option = Element::option($content)->props('value ' . $value); @@ -168,7 +170,7 @@ private function selectDropdown(): Element $input = Element::select( ...$elements )->props('id ' . $this->name, 'name ' . $this->name); - if (self::warningMessage() !== '') { + if ($hasWarningMessage) { $input = $input->prop('aria-invalid true'); $input = $input->prop('aria-describedby ' . $this->warningId); }