Apply Textarea rows and cols defaults only when meta omits them - #209
Merged
Merged
Conversation
Contributor
|
Coverage report for commit: e568049 Summary - Lines: 99.89% | Methods: 99.38%
🤖 comment via lucassabreu/comment-coverage-clover |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The defaults were set before parent::__construct read $meta, so the is_null guard never fired and setFieldMeta appended instead of overwriting. rows and cols take a single integer, so rows="5 4" made the browser read 5 and silently discard the caller's value.
rvanbaalen
force-pushed
the
fix/textarea-rows-cols-meta-override
branch
from
September 10, 2026 16:48
32767a8 to
e568049
Compare
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 #212.
<textarea>now renders therowsandcolsthe caller asked for.['cols' => 30, 'rows' => 4]rows="5 4" cols="21 30"rows="4" cols="30"['fieldrows' => 10, 'fieldcols' => 80]rows="5 10" cols="21 80"rows="10" cols="80"rows="5" cols="21"Cause
Textarea::__constructapplied its defaults beforeparent::__constructhad read$meta.__fieldmetawas still empty, so theis_nullguard never fired and the default was always written first.__initializeMetathen routed the caller's value throughsetFieldMeta, which appends with a space when$blnOverwriteis false.rowsandcolseach take a single valid non-negative integer. Browsers parse the leading digits and ignore the rest, sorows="5 4"reads as5— the caller's value was discarded with no error anywhere.Fix
Move
parent::__constructto the top of the constructor, so the guard reads the meta the caller actually passed. Same orderingButton::__constructalready uses.Tests
953 tests, 1754 assertions, green.
customRowsAndColsFromMetaAppendToDefaultsDueToSetMetaBehaviourasserted the broken output as a KNOWN LIMITATION. Renamed tocustomRowsAndColsFromMetaOverrideDefaults, assertions flipped.unprefixedRowsAndColsFromMetaOverrideDefaults. The old test only coveredfieldrows/fieldcols; the unprefixed form the class docblock documents had no coverage.toHtmlRendersDefaultRowsAndColsuntouched and still passing.For reviewers
Attribute order on
<textarea>shifts —classnow precedesrows/cols, becauseElement::__constructwrites the class into__fieldmetabefore the defaults land. Values identical, and the suite is order-insensitive (DOMXPathgetAttribute). Anything string-matching on textarea markup would notice.Unprefixed
cols/rowsalso leak onto the wrapper<div>. Separate bug inBase::__initializeMeta, not touched here.