Wikipedia:HiddenStructure
From Wikipedia, the free encyclopedia
By using Cascading Style Sheets (CSS), it is possible to hide text in templates from popular web browsers, dependent upon the emptiness of a template parameter. Please, don't use it. This page documents a specific highly controversial method to achieve that.
- On hiding text, see Help:Hidden text
| This page has been closed down by community consensus, and is retained only for historical reference. If you wish to restart discussion on the status of this page, seek community input at a forum such as the village pump. |
Brion VIBBER , lead developer of MediaWiki, describes some of the problems with hiddenStructure.
...it's using a CSS hack to hide structure elements, which can fail for text browsers, plaintext renderings of articles, and any HTML display of the article that doesn't use the stylesheet on this site. This harms both the primary site's accessibility and offsite reuse of material.
— Brion VIBBER (talk · contribs)
Graham87 , a blind Wikipedian, discusses screen reading software and the limitations therein, and also states that he doesn't believe we should use CSS hacks.
...I would strongly recommend that the css hacks not be used because there will be a sizable number of people using older screen readers, and they may not be able to upgrade.
How it works
This method relies on the existence of a CSS class "hiddenStructure". For the en: wiki this is defined in MediaWiki:Common.css as (revision as of 20:50, January 17, 2006):
/* hiddenStructure from Monobook - allows selective hiding of markup in templates */
.hiddenStructure {
display: none;
speak: none;
}
Any text that is contained within the HTML construct <div class="hiddenStructure">text to hide</div> is hidden. The class can also be applied to any XHTML element, such as <span> and wikitable rows (|-).
This function is then combined with the parameter default function to achieve selective hiding of text depending on the emptiness of the template parameter. Here is an example of a simple table, which could be part of a template. if the "parameter" is left blank, class{{{parameter|}}} resolves to simply class, completing the CSS call as above. For any value of "parameter", the style becomes meaningless and is stripped by the MediaWiki software, making the table row visible, as well as the data.
{|
|- class{{{parameter|}}}="hiddenStructure"
! Header
| {{{parameter|}}}
|}



