In version 4.0.0 (compatible with Vaadin 25), selected items in TwinColSelect fail to highlight visually.
Inspection of the rendered DOM shows that items utilize the standard ARIA attribute aria-selected="true" / aria-selected="false" when selected/deselected:
However, in twincolselect.css, the rule for selected item background targets the non-existent [checked] attribute:
While toggleValueFromClient() in SelectItem.java explicitly calls getElement().setAttribute("checked", true), the rendered DOM element in the browser only receives aria-selected="true", but not the checked attribute:
`HTML
`
Since a <div> is not a standard form element (like <input type="checkbox">), browsers / Vaadin Flow do not retain checked as a valid HTML attribute on a <div> in the DOM tree.
Therefore, CSS rules targeting div.twincolselect-item[checked] fail to match. Changing the selector in twincolselect.css from [checked] to [aria-selected="true"] resolves this, as aria-selected is properly reflected in the DOM for role="option" elements.
Furthermore, from an HTML/ARIA specification standpoint, since SelectItem assigns role="option", the element represents a list option.
According to W3C standards:
checked is strictly reserved for checkable controls like <input type="checkbox"> or <input type="radio">.
selected / aria-selected is the standard state attribute for elements with role="option".
Because of this, div.twincolselect-item[checked] in twincolselect.css is semantically the wrong selector for role="option" elements. Supporting [aria-selected="true"] (or [selected]) in the CSS is necessary to align with ARIA standards and ensure proper rendering across browsers.
With the new version, everything works as expected on our end.
We can confirm that the checked="" attribute is now properly reflected in the rendered DOM (<div class="twincolselect-item" checked="" ...>). The updated rule in twincolselect.css using !important applies the selection styles correctly now.