From c3c1bb2eba67b82b7f22ee87c8edbd8f098af028 Mon Sep 17 00:00:00 2001 From: Simon Karlen Date: Tue, 3 Aug 2021 11:05:04 +0200 Subject: [PATCH] fixed placeholder rendering in floating forms --- src/ActiveField.php | 1 + tests/ActiveFormTest.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ActiveField.php b/src/ActiveField.php index 75cb1b0..a38d9fc 100644 --- a/src/ActiveField.php +++ b/src/ActiveField.php @@ -519,6 +519,7 @@ class ActiveField extends \yii\widgets\ActiveField Html::addCssClass($config['labelOptions'], ['screenreader' => 'visually-hidden']); } elseif ($layout === ActiveForm::LAYOUT_FLOATING) { + $config['inputOptions']['placeholder'] = true; $config['template'] = "{input}\n{label}\n{error}\n{hint}"; Html::addCssClass($config['options'], ['layout' => 'form-floating mt-3']); } diff --git a/tests/ActiveFormTest.php b/tests/ActiveFormTest.php index 1fb7942..0da20a5 100644 --- a/tests/ActiveFormTest.php +++ b/tests/ActiveFormTest.php @@ -229,7 +229,7 @@ HTML; $expected = << - +
@@ -237,7 +237,7 @@ HTML; HTML; $expected2 = << -