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

Martin Grigorov commented on WICKET-6516:
-----------------------------------------

@ devs: What do you think about adding a new method to IComponentResolver that 
is called before the rendering starts ? This way AutoLabelResolver will have a 
chance to call `relatedComponent.setOutputMarkupId(true)`.

The idea is to traverse the page markup and resolve all components and 
auto-components, and call this new method for the auto components.

I have no idea how expensive this traversal will be at the moment.

> wicket:for on a label placed after the input doesn't generate id on the input
> -----------------------------------------------------------------------------
>
>                 Key: WICKET-6516
>                 URL: https://issues.apache.org/jira/browse/WICKET-6516
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 8.0.0-M8
>            Reporter: Virginie Garcin
>            Priority: Minor
>
> When using wicket:for on a label placed after the input, the id is not 
> automatically set on the related input, except if we force it by using 
> setOutputMarkupId(true).
> The attribute wicket:for by itself should force the id of the input to be 
> output, no matter if it is placed before or after the label, because like 
> that it's not consistent.
> Moreover, Bootstrap 4 custom checkboxes dictates us to put the label after 
> the input ( 
> https://getbootstrap.com/docs/4.0/components/forms/#checkboxes-and-radios-1 ).
> I feel that having to force the setOutputMarkupId(true) to the checkbox 
> everytime we use a checkbox isn't a clean solution.
> Example:
> {noformat}
> HTML:
> <div class="custom-control custom-checkbox">
>     <input wicket:id="active" type="checkbox" class="custom-control-input"/>
>     <label wicket:for="active" class="custom-control-label">Active</label>
> </div>
> Java:
> form.add( new CheckBox( "active" ) );
> Output HTML: the "for" on the label is there but the "id" on the input is 
> missing.
> <div class="custom-control custom-checkbox">
>     <input class="custom-control-input beingEdited pristine" 
> checked="checked" name="variations:0:active" type="checkbox">
>     <label class="custom-control-label" id="activebb-w-lbl" 
> for="activebb">Active</label>
> </div>
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to