Pending

User tests: Successful: Unsuccessful:

avatar bhuvan-somisetty
bhuvan-somisetty
20 Sep 2026

Pull Request resolves #48485.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

In Joomla\CMS\Form\Field\MeterField:

  1. MeterField::setup() previously extracted attributes like width, color, active, and animated from $this->element, but omitted min and max. As a result, custom min and max attributes defined in form XML were ignored and $this->min / $this->max remained at their default values (0 and 100).
  2. MeterField::__get() did not include min and max in its switch statement, returning null when accessing $field->min or $field->max (despite __set() supporting them).
  3. In the layout (layouts/joomla/form/field/meter.php), aria-valuemin and aria-valuemax and the width percentage calculation (((float) ($value - $min) * 100) / ($max - $min)) always operated on 0..100 instead of the configured range.

This PR:

  1. Adds extraction of min and max attributes in MeterField::setup().
  2. Adds min and max to the switch statement in MeterField::__get().
  3. Adds comprehensive unit tests in tests/Unit/Libraries/Cms/Form/Field/MeterFieldTest.php.

Testing Instructions

1. Automated Unit Tests

Run PHPUnit:

libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Form/Field/MeterFieldTest.php

2. Manual Test via Form Field

  1. Define a form XML with custom min and max on a meter field (e.g. min="10", max="50", value="30"):
<field
    name="my_meter"
    type="meter"
    label="Usage Meter"
    min="10"
    max="50"
    value="30"
/>
  1. Render the field:
$form = new \Joomla\CMS\Form\Form('test');
$form->load('<form><field name="my_meter" type="meter" label="Usage Meter" min="10" max="50" value="30" /></form>');
$field = $form->getField('my_meter');
echo $form->getInput('my_meter');
  1. Inspect $field->min, $field->max, and the rendered HTML.

Actual result BEFORE applying this Pull Request

  • $field->min and $field->max return null.
  • The rendered progress bar outputs aria-valuemin="0", aria-valuemax="100", and style="width:30%;" (calculated from 0..100).

Expected result AFTER applying this Pull Request

  • $field->min returns 10, and $field->max returns 50.
  • The rendered progress bar outputs aria-valuemin="10", aria-valuemax="50", and style="width:50%;" (calculated as (30 - 10) * 100 / (50 - 10)).

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Signed-off-by: bhuvan-somisetty somisettybhuvan5@gmail.com

avatar bhuvan-somisetty bhuvan-somisetty - open - 20 Sep 2026
avatar bhuvan-somisetty bhuvan-somisetty - change - 20 Sep 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Sep 2026
Category ⇒ Libraries Unit Tests
avatar brianteeman brianteeman - test_item - 20 Sep 2026 - Tested successfully
avatar brianteeman
brianteeman - comment - 20 Sep 2026

I have tested this item ✅ successfully on 12e7d63


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48486.

avatar brianteeman
brianteeman - comment - 20 Sep 2026

I have tested this item ✅ successfully on 12e7d63


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48486.

avatar chmst chmst - test_item - 12 Oct 2026 - Tested successfully
avatar chmst
chmst - comment - 12 Oct 2026

I have tested this item ✅ successfully on 12e7d63


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48486.

avatar chmst
chmst - comment - 12 Oct 2026

I have tested this item ✅ successfully on 12e7d63


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48486.

avatar chmst chmst - change - 12 Oct 2026
The description was changed
Status Pending ⇒ Ready to Commit
avatar chmst
chmst - comment - 12 Oct 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48486.

avatar chmst chmst - edited - 12 Oct 2026
avatar chmst
chmst - comment - 12 Oct 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48486.

Add a Comment

Login with GitHub to post a comment