Improving Accessibility

While looking through the HTML code generated by WordPress, I have come across several tags I was unfamiliar with. One of these was ACCESSKEY. At first sight, this would appear to be a very useful way of moving quickly about the page; indeed the Connections theme I use here uses accesskeys of a (About), c (Contact), h (Home/Recent), l (Links) and the UK Government came up with some standard definitions

  • S – Skip navigation
  • 1 – Home page
  • 2 – What’s new
  • 3 – Site map
  • 4 – Search
  • 5 – Frequently Asked Questions (FAQ)
  • 6 – Help
  • 7 – Complaints procedure
  • 8 – Terms and conditions
  • 9 – Feedback form
  • 0 – Access key details

However, the use of ACCESSKEYs can cause problems as described by the RNIB due to the fact that they override the default Browser keystrokes, so their use has rather fallen out of favour, especially on pages where data entry is required.

Useful resources for improving accessibility are:
BBC – http://www.bbc.co.uk/accessibility/
Abilitynet – http://www.abilitynet.org.uk/
Equality Commission – General web accessibility guidance – BS 8878, PAS78
BECTA (Archived) – Making Accessible Software

Putty Configuration

  • Download PuTTY from the official website. As a minimum you only need PuTTY.exe, but the zip file and installer also include the following utilities which you may find useful:
    • PSFTP (a Secure FTP client for transferring files between your web server and PC)
    • Pageant (an SSH authentication agent for PuTTY, PSCP and Plink which will let you log in automatically)
    • PuTTYgen (an utility to generate RSA and DSA key pairs – needed by Pageant).

    LEGAL WARNING: Use of PuTTY, PSCP, PSFTP and Plink is illegal in countries where encryption is outlawed. PuTTYtel (a Telnet-only client) is available as a separate download and does not include the SSH encryption.

  • Run putty.exe
  • Select Connection – SSH in the Category Panel. Make sure that AES (SSH-2 only) is the top selection
  • Select Window in the Category Panel. Set Columns to 135. Change scrollback to 2000.
  • Select Window – Behaviour in the Category Panel. Set System menu appears on ALT alone.
  • If you want to enable automatic login, run PuTTYGen
    • Generate a key pair
    • Edit the Key comment and Passphrase. You will need the passphrase later
    • Save the private key somewhere safe
    • Save the public key in /.ssh/authorized_keys on your webhost
      • Grant write permission to the directory chmod 777 /.ssh
      • Grant write permission to the file chmod 777 /.ssh/authorized_keys
      • Save the public key at the end of the file pico /.ssh/authorized_keys
      • Restore Read Only access to the file chmod 444 /.ssh/authorized_keys
      • Restore Read Only access to the directory chmod 555 /.ssh
    • Select Connection – Data in the Category Panel and enter your login under Auto login userb=name
    • Select Connection – SSH – Auth in the Category Panel and enter the path to your Private key. Set Allow agent forwarding.
  • Select Session in the Category Panel. Enter your domain under Hostname. Enter a Session name under Saved Sessions and Save the session
  • Click Open. If you followed the steps for automatic login, you will have to enter the passphrase. If you do not want to do this every time, run Pageant and add your key.

CSS Cascading priorities

Even though you have spent hours finely tuning your CSS style sheet, the webpage will not display correctly. You have even gone as far as defining a unique style the piece of text you are trying to format. What is the problem? It probably lies with the cascading order.

The primary sort of the declarations is by weight and origin

  • !important declarations override normal declarations.
  • For !important declarations, User style sheets override Author style sheets which override the Default style sheet.
  • For normal declarations, Author style sheets override User style sheets which override the Default style sheet.

Note. This is a semantic change since CSS1. In CSS1, author “!important” rules took precedence over user “!important” rules.

The secondary sort is by specificity of selector. A selector’s specificity is calculated by concatenating the three numbers a-b-c:

  • count the number of ID attributes in the selector (= a)
  • count the number of other attributes and pseudo-classes in the selector (= b)
  • count the number of element names in the selector (= c)
  • ignore pseudo-elements.

(Use the same number of digits for each parameter, eg 031023 if you have more than nine of a, b or c)

Some examples:

*             {}  /* a=0 b=0 c=0 -> specificity =   0 */
LI            {}  /* a=0 b=0 c=1 -> specificity =   1 */
UL LI         {}  /* a=0 b=0 c=2 -> specificity =   2 */
UL OL+LI      {}  /* a=0 b=0 c=3 -> specificity =   3 */
H1 + *[REL=up]{}  /* a=0 b=1 c=1 -> specificity =  11 */
UL OL LI.red  {}  /* a=0 b=1 c=3 -> specificity =  13 */ 
LI.red.level  {}  /* a=0 b=2 c=1 -> specificity =  21 */
#x34y         {}  /* a=1 b=0 c=0 -> specificity = 100 */ 

Inline style declarations (Example: <li style=”color:red;”>) are considered to have an ID selector (specifity of a=1, b=0, c=0) and to have been defined last, so will take priority.

If you want to override a certain property, you can force it by specifying !important to the definition. For example

  1. li.geshi {
  2.         background-image:none !important;
  3.         border:none;
  4.         padding: 0px;
  5. )
  6. #content ul li {
  7.     background: url(img/bullet.gif) no-repeat 0 7px;
  8. }

will force background-image to be none for any <li class=”geshi”> elements even if they are within an element with an ID of #content. The #content ID style would otherwise take precedence.

Using classes in Cascading Style Sheets

At first glance Cascading Style Sheets (CSS) are the panacea for our formatting woes. If I want a paragraph to be highlighted in yellow, then I would just have to define a class, apply this to the element and away we go.

But there is the knub. It appears that while properties are inherited, classes are not. Thus a paragraph element <p> will inherit the properties from its generic block container <div> but not the class.

For example, the code

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2.  
  3. <html>
  4.  <head>
  5.   <style type="text/css">
  6.     #first { color: blue; }
  7.    .two { color: red; text-indent: 4em; }
  8.    p.three{ color:green; }
  9.   </style>
  10.  </head>
  11.  
  12.  <body>
  13.   <div id="first">
  14.    <p>This paragraph will inherit its properties from ID first and therefore be in blue</p>
  15.   </div>
  16.   <div class="two">
  17.    <p>This paragraph will be formatted using class two and be in red, indented 4 em because the style is inherited from the div element to which the style has been applied</p>
  18.   </div>
  19.   <div class="three">
  20.    <p>This paragraph will not be formatted using style three because the style definition only applies to the paragraph element with a class of three and classes are not inherited</p>
  21.    <p class="three">so the style is not applied unless the class is explicitly stated</p>
  22.   </div>
  23.  </body>
  24.  
  25. </html>

produces the following output

This paragraph will inherit its properties from ID first and therefore be in blue

This paragraph will be formatted using class two and be in red, indented 4 em because the style is inherited from the div element to which the style has been applied

This paragraph will not be formatted using style three because the style definition only applies to the paragraph element with a class of three and classes are not inherited

so the style is not applied unless the class is explicitly stated

Problems assembling files

I could not even assemble a simple Hello World program today :(, must be too tired. I kept getting the error

parse error before `(‘
`main’ declared as function returning a function

The answer should of course be to use curly braces { } on lines 3 and 6

Wrong

  1. #include <stdio.h>
  2. int main (void)
  3.    (
  4.        printf ("Hello World!\n");
  5.        return 0;
  6.    )

$ gcc -c -o test2.o test2.c –save-temps
test2.c:4: parse error before `(‘
test2.c:4: `main’ declared as function returning a function

Right

  1. #include <stdio.h>
  2. int main (void)
  3.    {
  4.        printf ("Hello World!\n");
  5.        return 0;
  6.    }

$ gcc -c -o test2.o test2.c –save-temps
$ echo $?
0