[ 
https://issues.apache.org/jira/browse/WICKET-7114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939540#comment-17939540
 ] 

Simon Voges commented on WICKET-7114:
-------------------------------------

[~pedrosans], of course I'm ok with an pull request. I'm worried about test 
code that might break, but this bug does lead to unintended behavior. I just 
noticed the wrong element being replaced in the browser due to a duplicated ID.

> DefaultMarkupIdGenerator creates duplicate IDs in 
> RuntimeConfigurationType.DEVELOPMENT
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-7114
>                 URL: https://issues.apache.org/jira/browse/WICKET-7114
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.15.0, 9.17.0, 10.1.0
>            Reporter: Simon Voges
>            Priority: Minor
>
> 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. 
> {quote}
> The id global attribute defines an identifier (ID) which must be unique in 
> the whole document.
> {quote}
> [mdn 
> webdocs|https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id]
> *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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to