Hi Sven, On Tue, Feb 25, 2020 at 10:54 PM Sven Meier <[email protected]> wrote:
> Hi all, > > we have a disagreement on how to style hidden elements in Wicket 9.x. > > Due to the new CSP support we can no longer use inline styling to hide > elements. > WICKET-6725 introduces new CSS classes and a file wicket-core.css. > > I don't think this is a good approach: > > - it adds a CSS file that is referenced by each page (after Wicket doing > fine without it for 15 years) > I am also not big fan of CSP but users ask for it and I see no other way but to move all inline styles in such .css resource > - the CSS is a mingle-mangle of out-of-date stylings (see > .wicket--hidden-fields) > What do you suggest to use instead ? > - it's a kitchen-sink for left-over styles (see .wicket--color-red) > I agree that for this one Wicket can just add the CSS class (e.g. wicket-feedback-indicator) on the HTML element and let the application provide the CSS rules for it > - it introduces a new class naming scheme not used anywhere else (wicket--) > We need this "namespace" to avoid clashes with the applications' styles. I see nothing bad in this one. > > IMHO we should remove that file again (and the required infrastructure > in ResourceSettings/WebApplication) and just > use the HTML5 "hidden" attribute instead, whenever we want to hide > something (Component, Form, ...). This "just works" in all browsers and is semantically correct. It has > one caveat when an application's CSS changes the default styling of > hidden elements (see > https://css-tricks.com/the-hidden-attribute-is-visibly-weak), but that's > in the responsibility of the application developer. > I don't agree here. If each and every developer should make sure that Wicket's placeholder tags should stay invisible then the framework does not do its job. Often when we see that something is too common we actually add it to the framework. Here you ask to do the reverse - remove the support and ask the developers to deal with it. The article you linked to explains it well that "hidden" attribute does not really work. CSS libraries which provide reset rules like div { display: block; } will make the life of the developer miserable. > AjaxIndicatorAppender can just render a CSS class and leave the styling > to the application developer, nobody will be happy with the default > "red" anyway. > +1 on this ^^ > > Thus I'll be starting a vote in the next days with the following two > options: > > [] leave as is with .wicket--hidden & wicket-core.css > > [] use HTML5 "hidden" attribute instead > > This isn't the vote yet, it's just the announcement. > Maybe others see a third (forth?) option or want to raise their concerns > first. > An idea: if CSP is disabled then Wicket can deliver the content of wicket-core.css as inline CSS, i.e. <style>....</style>. This will keep the number of http requests the same as before. Martin > > Sven > > >
