Skip to content

Commit

Permalink
Fix flag sizes in the country field in Safari browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jul 27, 2024
1 parent 9c39cc4 commit c027fb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Field/Configurator/CountryConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private function generateFormTypeChoices(string $countryCodeFormat, ?array $coun

$countryCodeAlpha2 = $usesAlpha3Codes ? Countries::getAlpha2Code($countryCode) : $countryCode;
$flagImagePath = $this->assetPackage->getUrl(sprintf('images/flags/%s.svg', $countryCodeAlpha2));
$choiceKey = sprintf('<div class="country-name-flag"><img src="%s" class="country-flag" loading="lazy" alt="%s"> <span>%s</span></div>', $flagImagePath, $countryName, $countryName);
$choiceKey = sprintf('<div class="country-name-flag"><img src="%s" height="17" class="country-flag" loading="lazy" alt="%s"> <span>%s</span></div>', $flagImagePath, $countryName, $countryName);

$choices[$choiceKey] = $countryCode;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Field/CountryFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testDefaultOptionsForFormPages()
$formSelectChoices = $fieldDto->getFormTypeOption(ChoiceField::OPTION_CHOICES);

self::assertCount(self::NUM_COUNTRIES_AND_REGIONS, $formSelectChoices);
self::assertSame('GQ', $formSelectChoices['<div class="country-name-flag"><img src="images/flags/GQ.svg" class="country-flag" loading="lazy" alt="Equatorial Guinea"> <span>Equatorial Guinea</span></div>']);
self::assertSame('GQ', $formSelectChoices['<div class="country-name-flag"><img src="images/flags/GQ.svg" height="17" class="country-flag" loading="lazy" alt="Equatorial Guinea"> <span>Equatorial Guinea</span></div>']);
self::assertSame('true', $fieldDto->getFormTypeOption('attr.data-ea-autocomplete-render-items-as-html'));
}

Expand Down

0 comments on commit c027fb1

Please sign in to comment.