Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 How it works  





2 Caveats  



2.1  Problems  





2.2  Solutions  







3 Other uses  



3.1  Known uses  







4 See also  














Wikipedia:HiddenStructure







Add links
 









Project page
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


On hiding text, see Help:Hidden text

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.

Brion VIBBER [1], 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.

Graham87 [2], 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.

— Graham87 (talk · contribs)

How it works[edit]

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|}}}
|}

Caveats[edit]

This method does not hide text from any non-CSS browsers (including text-only browsers, like Lynx), nor from users of many types of screen readers and other accessibility software. Pages relying on this method also fail to display properly when copied to other sites which have not been configured to use the 'hiddenStructure' class, including foreign language Wikipedias and possibly some Wikipedia mirrors. Therefore, it is important that the template be readable and make sense to someone using such a browser. If a page depends on this technique to make sense, then it will break a WAI priority 1 accessibility checkpoint. Some common pitfalls involve overuse of this by marking every row in an Infobox as optional, or using this method to hide punctuation around an optional parameter.

Problems[edit]

USS Monitor using CSS hacks
USS Monitor using meta-templates
Blue Whale using CSS hacks
Blue Whale using meta-templates

The problem with using hiddenStructure is that it hides rows in a non-standard way. Whereas other websites hide data by simply not sending it out from the server[1], hiddenStructure defers this hiding process to the client. Because of this, some non-CSS aware or compliant browsers incorrectly render pages using this hack (see pictures at right).

Some pages minimize the damage by only displaying the parameter if it's actually non-blank (using the syntax {{{parameter|}}}). In this way only the row is displayed, not the ugly {{{parameter}}} parameter name. Of course in templates with large numbers of conditional rows, this still results in unnecessary data being displayed to non-CSS compliant browsers.

Because of these problems many articles render poorly for the disabled. In the worst case, a number of Wiki-markup parameters are displayed/read to the reader. In the best case, a number of rows are displayed/read which are empty.

For these reasons, hiddenStructure should not be used.

Footnote:

  1. ^ Most websites use PHPorASP to conditionally send data from the server. More advanced designs cache results so PHP/ASP scripts are only executed once for each possible outcome.

Solutions[edit]

Solutions, in order of preference, are.

Other possible solutions, which are ill-advised, include:

Other uses[edit]

One of several accepted uses of CSS display: none is to hide kludges inserted only for legacy browsers from modern browsers. A typical example is reset-buttons; no modern browser needs this, as users can clear textareas locally. Legacy browsers don't offer this feature and depend on a reset-button. Users clicking reset unintentionally would lose their modifications in the form. A hidden reset-button only visible with legacy browsers avoids this problem.

Other examples are media specific applications: Emoticons (smileys) as ASCII art are arguably pointless for speech browsers, it's possible to hide them there, maybe offering a WAV. Sometimes copyright info can be restricted to the printed output. Info normally only available for visual browsers with a mouse could be additionally displayed as normal text hidden from most output media except from text, print, and speech. A similar concept is the <noscript> element.

Known uses[edit]

This is an incomplete list of known uses arguably considered to be harmless, please add what you find:
  1. Template:Hide(edit talk links history) - probably not harmless

See also[edit]


Retrieved from "https://en.wikipedia.org/w/index.php?title=Wikipedia:HiddenStructure&oldid=1155417879"

Categories: 
Inactive project pages
Wikipedia template administration
Wikipedia how-to
 



This page was last edited on 18 May 2023, at 02:23 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki