Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
8.15.0, 9.17.0, 10.1.0
-
None
-
None
Description
While testing an application for accessibility, I noticed the analyzer reporting duplicated ids in markup. The issue was hard to reproduce, so I didn't give it much attention.
When I finally found a way to reproduce it, I tracked it down to a bug in DefaultMarkupIdGenerator. If the application is running in Development mode, the DefaultMarkupIdGenerator will prefix every generated MarkupId with the Components id. If the component is a repeaters child, the ID will be numeric.
Dependening on the order of the Components, it is possible that DefaultMarkupIdGenerator will generate duplicated ids.
markupIdPrefix (component.getId()) | markupIdPostfix (sequence value as hex string) | effective markupId |
---|---|---|
11 | a | 11a |
1 | 1a | 11a |
Fixing it by adding a delimiter seems like a straightforward solution, but I'm not sure what could break down the road. I'm especially worried that many tests might brake in the wild, because it is just so convenient to use the markup ids in the tests.
Duplicate IDs are a problem because it just breaks the spec.
The id global attribute defines an identifier (ID) which must be unique in the whole document.
Steps to reproduce
Please have a look into https://github.com/HerrDietz/WICKET-7114. This repo contains two test cases. One is a unit test for DefaultMarkupIdGenerator, the other one renders a page containing a duplicated id.