[
https://issues.apache.org/jira/browse/WW-5781?focusedWorklogId=1047758&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1047758
]
ASF GitHub Bot logged work on WW-5781:
--------------------------------------
Author: ASF GitHub Bot
Created on: 16/Oct/26 07:11
Start Date: 16/Oct/26 07:11
Worklog Time Spent: 10m
Work Description: lukaszlenart merged PR #2026:
URL: https://github.com/apache/struts/pull/2026
Issue Time Tracking
-------------------
Worklog Id: (was: 1047758)
Time Spent: 0.5h (was: 20m)
> checkboxlist and radio render class and style attributes twice,
> cssErrorClass/cssErrorStyle never apply
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-5781
> URL: https://issues.apache.org/jira/browse/WW-5781
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Tags
> Reporter: Lukasz Lenart
> Priority: Major
> Fix For: 7.5.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> {{template/simple/checkboxlist.ftl}} (also used by {{xhtml}}) and
> {{template/html5/checkboxlist.ftl}} write {{class}} and {{style}} on each
> checkbox themselves (from {{listCssClass}}/{{listCssStyle}}, falling back to
> {{cssClass}}/{{cssStyle}}) and then include {{css.ftl}}, which writes
> {{class}} and {{style}} again.
> Rendering {{<s:checkboxlist name="collection" list="list" listKey="top[0]"
> listValue="top[1]" cssClass="myClass" cssStyle="width:150px"/>}} with the
> simple theme produces:
> {code:html}<input type="checkbox" name="collection" value="hello"
> id="collection-1" class="myClass" style="width:150px" class="myClass"
> style="width:150px" />
> {code}
> and with {{listCssClass="'itemClass'"}} added:
> {code:html}<input type="checkbox" ... class="itemClass" style="width:150px"
> class="myClass" style="width:150px" />
> {code}
> {{template/simple/radiomap.ftl}} and {{template/html5/radiomap.ftl}} (the
> {{s:radio}} tag) have the same defect whenever {{listCssClass}} or
> {{listCssStyle}} is set: the item {{class}}/{{style}} is written, then
> {{css.ftl}} writes the tag-level ones again.
> Duplicate attributes are invalid HTML and browsers keep only the first
> occurrence. With field errors present, the {{class="myClass errclass"}} /
> {{cssErrorStyle}} value written by {{css.ftl}} comes second and is dropped,
> so {{cssErrorClass}} and {{cssErrorStyle}} have no effect on these inputs.
> Expected: each checkbox/radio input carries a single {{class}} and a single
> {{style}} attribute. {{listCssClass}}/{{listCssStyle}} replace
> {{cssClass}}/{{cssStyle}} (what browsers render today), {{cssErrorClass}} is
> appended and {{cssErrorStyle}} applied when the field has errors, following
> the {{css.ftl}} rules. No existing test covers {{cssClass}} on these inputs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)