Fix: Country label ignores "Use label" toggle#596
Closed
Conversation
Co-authored-by: goranalkovic-infinum <77000136+goranalkovic-infinum@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bug where country label is shown when hidden
Fix: Country label ignores "Use label" toggle
Mar 10, 2026
iruzevic
approved these changes
Mar 10, 2026
iruzevic
previously approved these changes
Mar 10, 2026
dadadavorin
previously approved these changes
Mar 10, 2026
Contributor
|
@copilot Looks good, but can you please write tests for this? |
Co-authored-by: goranalkovic-infinum <77000136+goranalkovic-infinum@users.noreply.github.com>
Contributor
Author
Added in commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The country field label rendered on the frontend regardless of the "Use label" toggle state in the editor.
Root cause
country.phpunconditionally included'fieldHideLabel' => $countryHideLabel(alwaysfalseunless "Use label as placeholder" was on) in the$fieldOutputarray. This hardcodedfalseclobbered thecountryFieldHideLabel = trueattribute set by the editor toggle whenHelpers::props('field', $attributes, $fieldOutput)merged them.Fix
country.php: RemovefieldHideLabelfrom the static$fieldOutputarray. The existing conditional block already handles setting it totruefor the "Use label as placeholder" case — consistent with howselect.phphandles the same pattern.Tests
Added Playwright E2E tests in
tests/e2e/field-country.test.jscovering:country-default: label is visible with correct text when "Use label" is enabledcountry-hide-label: label is hidden when the "Use label" toggle is turned off (directly validates the bug fix)country-placeholder-use-label: label is hidden when "Use label as placeholder" is enabled (regression check)Test data was added to
tests/e2e/playground/dataset.xml(country form post + page), andtests/e2e/playground/playground.jsonwas updated to load the dataset from the auto-mounted plugin VFS path instead of a hardcoded remote branch URL.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.