Keep rows, cols and multiple off the wrapper div - #211
Merged
Merged
Conversation
__initializeMeta renamed $key to "field" . $key before unsetting it, so the original entry survived in __meta and rendered on the wrapper. With that corrected, __getMetaString no longer needs to filter against __fieldmeta, which it did by value rather than by key. Closes #210
Contributor
|
Coverage report for commit: 3f71c47 Summary - Lines: 99.89% | Methods: 99.38%
🤖 comment via lucassabreu/comment-coverage-clover |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flangfeldt
approved these changes
Sep 13, 2026
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.
Closes #210.
rows,colsandmultiplenow render only on the input, not on the wrapper<div>as well.['cols' => 30, 'rows' => 4]<div cols="30" rows="4" class="vf__optional"><div class="vf__optional">['multiple' => true]<div multiple="1" class="vf__optional"><div class="vf__optional">Cause
Base::__initializeMeta()renames$keyto"field" . $key, routes the value, then callsunset($this->__meta[$key])— removing"fieldcols", which never existed. The original"cols"survives and__getMetaString()prints it on the wrapper.Only the unprefixed form is hit;
fieldcolsskips the rename so its unset matches. Unprefixed is the intended form here —$__reservedfieldmetaexists to route these three keys,Element::setClass()reads$meta["multiple"]unprefixed to pickvf__oneorvf__multiple, andexamples/textarea.phpdocuments"cols"/"rows".Fix
Capture the key before the rename, unset that one.
That leaves
__getMetaString()'s second guard with nothing to catch, and it was wrong anyway:array_mergecontributes__fieldmeta's values, not its keys, so a wrapper attribute vanished whenever an unrelated field meta value equalled its name —['fieldplaceholder' => 'class']erased the wrapper's ownclass="vf__optional". Merge dropped.array_keys()is not a valid replacement:__fieldmetaalways carries aclasskey, so it would suppressclasson every wrapper.Tests
955 tests, 1765 assertions, green. Three added, each confirmed to fail on
masterbefore the fix:TextareaTest::unprefixedRowsAndColsStayOffTheWrapperSelectTest::multipleMetaStaysOffTheWrapperElementTest::wrapperAttributesSurviveAFieldMetaValueMatchingTheirNameEach asserts both halves — gone from the wrapper, still on the input — so the routing cannot be dropped to make them pass.
ElementTestgaineduse HtmlAssertionsTrait; it had no DOM helper.For reviewers
The
__initializeMeta()docblock above the changed loop said$meta["labelstyle"]becomes$__fieldmeta["style"]. It becomes$__labelmeta["style"]. Corrected in place — say so if you want it split out.PR #209 fixes a different defect in the same area (
Textareaappending its defaults). No conflict. Textareas on this branch still renderrows="5 4", so the new textarea test asserts a clean wrapper rather than an exactrowsvalue.