processwire / processwire-issues

ProcessWire issue reports.
45 stars 2 forks source link

No index after 99 Elements and black background in Repeater #1617

Closed gs-df closed 1 year ago

gs-df commented 2 years ago

Short description of the issue

When i add the 100th Repeater Element the index counts just to 99 and the repeater element background change from green to black. But the repeater still works.

Expected behavior

Continue counting over 100 and green background. (Any reason for black background?)

Screenshots/Links that demonstrate the issue

repeater-fail repeater-works

Suggestion for a possible fix

When i comment this code out, it works like expected Filename: InputfieldRepeater.module Row: 480 - 489

                if(strpos($wrapLabel, '#') !== false && preg_match('/(?<!&)#([0-9a-fA-F]{3,})/', $wrapLabel, $matches)) {
                    // background-color definition
                    if(strlen($matches[1]) === 3 || strlen($matches[1]) === 6) {
                        $wrapLabel = str_replace($matches[0], '', $wrapLabel);
                        $typeStyles[$itemTypeName] = 
                            ".Inputfield_$this->name .InputfieldContent " . 
                            ".InputfieldRepeaterItem[data-typeName=\"$itemTypeName\"] > .InputfieldHeader " . 
                            "{ background-color: #$matches[1]; outline-color: #$matches[1] }";
                    }
                }

Steps to reproduce the issue

  1. Create Repeater
  2. Add 100 Elements
  3. Look behavior (No counting over 99 and black background)
  4. Remove 1 Element (Green Background again)

Setup/Environment

ryancramerdesign commented 2 years ago

@gs-df The index number must be confusing the label color configuration option. I think we did recently fix a related issue on the dev branch (maybe in 3.0.201 or 3.0.202) and I suspect this is the same thing. I don't have any installs with 100+ repeater items to test with here but if you get a chance to try the dev branch sometime please let me know if you continue to observe the issue. Thanks.

matjazpotocnik commented 2 years ago

@gs-df, did you test on the latest dev branch?

matjazpotocnik commented 1 year ago

@gs-df Closing this now. Post more if it needs re-opening.

BitPoet commented 1 year ago

Unless there's side effects in Repeater Matrix that I'm not aware of, swapping the code parts for replacing color and #n in InputfieldRepeater___renderRepeaterLabel() should be enough to fix this.

repeater-numbers-and-colors

ryancramerdesign commented 1 year ago

@BitPoet Thanks, I have added your suggestion for this.

matjazpotocnik commented 1 year ago

@BitPoet I'm closing this now. Thanks for the fix!