jakartaee / jakartaee/faces

f:selectItems ignore itemDescription within h:selectOneListbox and related components

Open
#1,285 5 comments 0 reactions 0 assignees View on GitHub
Component: Components/Renderers Priority: Major Type: Bug
Dominant language
Java
Stars
127
Forks
59
Avg merge
23h
Merged PRs (30d)
7

Description

Facelets tag lib documentation shows the following properties as valid for f:selectItems:

itemValue
itemLabel
itemDescription
itemDisabled
itemLabelEscaped
...

But in both Mojarra and MyFaces the attribute itemDescription, itemDisabled, itemLabel are ignored.

But taking a look at the renderkit spec javadoc of javax.faces.SelectMany/javax.faces.Listbox in the section "Rendering the "option" elements" it says this:

"... If the current child is a UISelectItem create a SelectIteminstance from its itemValue, itemLabel, itemEscaped, and itemDescription properties, add it to the list. If the current child is a UISelectItems instance, call its getValue() method. If the result is a SelectItem bean, add it to the list. If the result is an array of SelectItem beans, add each one to the list. If the result is a Collection of SelectItem beans, add each one to the list. If the result is a Map, create a SelectItem bean for each entry in the Map using the key as the label, the value as the value, and null as the description. ..."

So, these properties are supposed to be used with f:selectItem, not with f:selectItems. But the user perceive this as a bug, which is something logic. See:

[https://issues.apache.org/jira/browse/MYFACES-3901](https://issues.apache.org/jira/browse/MYFACES-3901)

In JSF 2.2 with HTML5 friendly markup, it is supposed that f:selectItems can have passthrough attributes. See:

[https://issues.apache.org/jira/browse/MYFACES-3879](https://issues.apache.org/jira/browse/MYFACES-3879)

But in MyFaces we found that it doesn't work for h:selectOneRadio or h:selectManyCheckbox.

The thing is the fix for this issue is pretty similar for the one that needs to be done for HTML5 friendly markup.
#### Affected Versions
[2.0, 2.1, 2.2]

Contributor guide

Open the contributing guide

Research direction

Start with the renderkit specification section on rendering option elements and compare behavior in h:selectOneListbox, h:selectOneRadio, and h:selectManyCheckbox. Review the related HTML5-friendly-markup work referenced in MYFACES-3879 and verify that the relevant f:selectItems properties or passthrough attributes are preserved and rendered as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.