Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX remove placeholder search text on readonly field #11419

Open
wants to merge 2 commits into
base: 5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Forms/SearchableDropdownTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public function getPlaceholder(): string
return $emptyString;
}
}
$name = $this->getName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this isn't used below, which I assume is why you've removed it? Please add a note in future when making changes like this so it's easier to know what's going on.

It's obvious in your IDE because it presumably gets greyed out, but seeing why a change like this was made in a git diff requires more double checking.

if ($this->getUseDynamicPlaceholder()) {
if ($this->getIsSearchable()) {
if (!$this->getIsLazyLoaded()) {
Expand Down Expand Up @@ -598,6 +597,9 @@ public function performReadonlyTransformation()
$field->setSource($this->sourceList);
$field->setReadonly(true);

// Remove the text "Type to search..." on a read-only field
// $field->setPlaceholder('');

return $field;
}
}
2 changes: 2 additions & 0 deletions tests/php/Forms/SearchableDropdownTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public function testPlaceholder(): void
$this->assertSame('My empty string', $field->getPlaceholder());
$field->setPlaceholder('My placeholder');
$this->assertSame('My placeholder', $field->getPlaceholder());
$readonlyField = $field->performReadonlyTransformation();
$this->assertSame('', $readonlyField->getPlaceholder());
}

public function testSeachContext(): void
Expand Down
Loading