Skip to content

Apply Textarea rows and cols defaults only when meta omits them - #209

Merged
flangfeldt merged 1 commit into
masterfrom
fix/textarea-rows-cols-meta-override
Sep 13, 2026
Merged

flangfeldt merged 1 commit into
masterfrom
fix/textarea-rows-cols-meta-override

Conversation

@rvanbaalen

@rvanbaalen rvanbaalen commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Closes #212.

<textarea> now renders the rows and cols the caller asked for.

Meta passed Before After
['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"
nothing rows="5" cols="21" unchanged

Cause

Textarea::__construct applied its defaults before parent::__construct had read $meta. __fieldmeta was still empty, so the is_null guard never fired and the default was always written first. __initializeMeta then routed the caller's value through setFieldMeta, which appends with a space when $blnOverwrite is false.

rows and cols each take a single valid non-negative integer. Browsers parse the leading digits and ignore the rest, so rows="5 4" reads as 5 — the caller's value was discarded with no error anywhere.

Fix

Move parent::__construct to the top of the constructor, so the guard reads the meta the caller actually passed. Same ordering Button::__construct already uses.

Tests

953 tests, 1754 assertions, green.

  • customRowsAndColsFromMetaAppendToDefaultsDueToSetMetaBehaviour asserted the broken output as a KNOWN LIMITATION. Renamed to customRowsAndColsFromMetaOverrideDefaults, assertions flipped.
  • Added unprefixedRowsAndColsFromMetaOverrideDefaults. The old test only covered fieldrows/fieldcols; the unprefixed form the class docblock documents had no coverage.
  • toHtmlRendersDefaultRowsAndCols untouched and still passing.

For reviewers

Attribute order on <textarea> shifts — class now precedes rows/cols, because Element::__construct writes the class into __fieldmeta before the defaults land. Values identical, and the suite is order-insensitive (DOMXPath getAttribute). Anything string-matching on textarea markup would notice.

Unprefixed cols/rows also leak onto the wrapper <div>. Separate bug in Base::__initializeMeta, not touched here.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report for commit: e568049
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
 100% │ ███████████████████████ │ 100.0%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 99.89% | Methods: 99.38%
FilesLinesMethodsBranches
classes/ValidFormBuilder
   Area.php100.00%100.00%100.00%
   Base.php99.26%97.50%100.00%
   Button.php100.00%100.00%100.00%
   Checkbox.php100.00%100.00%100.00%
   ClassDynamic.php100.00%100.00%100.00%
   Collection.php100.00%100.00%100.00%
   Comparison.php100.00%100.00%100.00%
   Condition.php98.51%88.89%100.00%
   Element.php100.00%100.00%100.00%
   FieldValidator.php100.00%100.00%100.00%
   Fieldset.php100.00%100.00%100.00%
   File.php100.00%100.00%100.00%
   Group.php100.00%100.00%100.00%
   GroupField.php100.00%100.00%100.00%
   Hidden.php100.00%100.00%100.00%
   MultiField.php100.00%100.00%100.00%
   Navigation.php100.00%100.00%100.00%
   Note.php100.00%100.00%100.00%
   Page.php100.00%100.00%100.00%
   Paragraph.php100.00%100.00%100.00%
   Password.php100.00%100.00%100.00%
   Select.php100.00%100.00%100.00%
   SelectGroup.php100.00%100.00%100.00%
   SelectOption.php100.00%100.00%100.00%
   StaticText.php100.00%100.00%100.00%
   Text.php100.00%100.00%100.00%
   Textarea.php100.00%100.00%100.00%
   ValidForm.php100.00%100.00%100.00%
   ValidWizard.php100.00%100.00%100.00%
   Validator.php100.00%100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

@rvanbaalen rvanbaalen changed the title Textarea rows and cols meta no longer append to the built-in defaults fix(Textarea): apply rows/cols defaults only when meta omits them Sep 10, 2026
@rvanbaalen rvanbaalen changed the title fix(Textarea): apply rows/cols defaults only when meta omits them Apply Textarea rows and cols defaults only when meta omits them Sep 10, 2026
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
rvanbaalen force-pushed the fix/textarea-rows-cols-meta-override branch from 32767a8 to e568049 Compare September 10, 2026 16:48
@rvanbaalen rvanbaalen self-assigned this Sep 10, 2026
@flangfeldt
flangfeldt merged commit 2dca6ac into master Sep 13, 2026
6 checks passed
@flangfeldt
flangfeldt deleted the fix/textarea-rows-cols-meta-override branch September 13, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Textarea rows and cols defaults append to the caller's value instead of yielding to it

2 participants