Skip to content

Commit b5203fd

Browse files
committed
FIX remove placeholder search text on readonly field
1 parent 483e944 commit b5203fd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Forms/SearchableDropdownTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ public function getPlaceholder(): string
139139
return $emptyString;
140140
}
141141
}
142-
$name = $this->getName();
143142
if ($this->getUseDynamicPlaceholder()) {
144143
if ($this->getIsSearchable()) {
145144
if (!$this->getIsLazyLoaded()) {
@@ -598,6 +597,9 @@ public function performReadonlyTransformation()
598597
$field->setSource($this->sourceList);
599598
$field->setReadonly(true);
600599

600+
// Remove the text "Type to search..." on a read-only field
601+
$field->setPlaceholder('');
602+
601603
return $field;
602604
}
603605
}

tests/php/Forms/SearchableDropdownTraitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public function testPlaceholder(): void
7373
$this->assertSame('My empty string', $field->getPlaceholder());
7474
$field->setPlaceholder('My placeholder');
7575
$this->assertSame('My placeholder', $field->getPlaceholder());
76+
$readonlyField = $field->performReadonlyTransformation();
77+
$this->assertSame('', $readonlyField->getPlaceholder());
7678
}
7779

7880
public function testSeachContext(): void

0 commit comments

Comments
 (0)