You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "bgooren (via GitHub)" <gi...@apache.org> on 2026/10/01 10:36:39 UTC

[PR] Avoid auto-label markup ID warnings for body-only form components [wicket]

bgooren opened a new pull request, #1633:
URL: https://github.com/apache/wicket/pull/1633

   Fixes #1632.
   
   Using `wicket:for` with a standard `CheckGroup` currently produces
   “Markup id set on a component that renders its body only” warnings.
   The auto-label resolver enables markup ID output on a component that
   renders its body only by default.
   
   This change skips enabling markup ID output and omits the label's HTML
   `for` attribute for body-only targets. Their labels receive an independent,
   session-generated ID stored in component metadata, keeping it stable
   across renders and available for Ajax status updates.
   
   Label text and required/error/disabled CSS classes remain supported.
   The existing label-ID scheme is preserved for targets that render their
   own tag.
   
   ### Tests
   
   The regression test fails on unmodified Wicket with
   `NotRenderableErrorStrategy.THROW_EXCEPTION` and passes with this fix.
   It verifies that:
   
   - The CheckGroup receives neither a markup ID nor outputMarkupId=true.
   - The label has no HTML `for` attribute.
   - `<wicket:label>` and required/error/disabled classes still work.
   - The label ID remains stable across renders.
   - Ajax status updates reference the independent label ID.
   
   All 29 AutoLabel tests pass.
   
   ### Edge case
   
   Changing a target's `renderBodyOnly` setting during its lifecycle switches
   between the independent label ID and the existing component-derived ID.
   This change does not address that transition. Standard CheckGroup usage
   keeps the setting unchanged.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Avoid auto-label markup ID warnings for body-only form components [wicket]

Posted by "bgooren (via GitHub)" <gi...@apache.org>.
bgooren commented on PR #1633:
URL: https://github.com/apache/wicket/pull/1633#issuecomment-5930174663

   Withdrawing this proposal. I agree that the default warning is useful for users who inadvertently apply an auto label to a body-only component. Our use case is a reusable form-field wrapper that intentionally accepts such components, so we will handle that behavior in application code. Thanks for the feedback.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Avoid auto-label markup ID warnings for body-only form components [wicket]

Posted by "bgooren (via GitHub)" <gi...@apache.org>.
bgooren closed pull request #1633: Avoid auto-label markup ID warnings for body-only form components
URL: https://github.com/apache/wicket/pull/1633


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org