reiern70 opened a new pull request, #1890: URL: https://github.com/apache/wicket/pull/1890
Closes #1886 Stacked on #1887 (GitHub issue #1884). Its base is `email-pattern-1884`, so the diff shows only this fix. Merge #1887 first; GitHub then retargets this PR to `master`. `AbstractTextComponent` and the `HTML5Attributes` behavior copied the pattern of every `PatternValidator` into the HTML `pattern` attribute, ignoring `setReverse(true)`. A reversed validator rejects input that matches the pattern, and the attribute makes the browser reject input that does not. So no non-empty value passed both checks. The browser blocked the submit of a value the server would accept, and the server rejected the rest (checked in Chrome and Firefox). ### What it does now - A reversed validator renders no `pattern` attribute, and its input is checked on the server only. An HTML `pattern` cannot reliably express "must not match" for an arbitrary Java pattern. - `PatternValidator#isReverse()` is new (`@since 12.0.0`), so the renderers can see the flag. It is a method added to the API, with no change to existing members. - The javadoc of `PatternValidator` and of `setReverse` says that a reversed validator renders no attribute. ### What applications see A field with a reversed validator submits again. The server still reports matching input, as before. Nothing changes for a validator that is not reversed. Nothing to migrate. ### Backport Not done yet. It would apply to `wicket-11.x` (`AbstractTextComponent` and `HTML5Attributes`) and to `wicket-10.x` (`HTML5Attributes` only), with `@since` adjusted. ### Tests - `TextFieldTest`: a `PatternValidator` renders its pattern. A reversed one renders none, from the component or from `HTML5Attributes`. Both reversed cases fail without the fix. - `mvn clean verify -Pjs-test` is green. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
