DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Accessible Menus

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Ernesto Baschny
Changed:2006-04-18T09:38:52
Email:ernst@cron-it.de

EXT: Accessible Menus

Extension Key: cron_accessiblemenus

Copyright 2005, 2006, ernst@cron-it.de, <ernst@cron-it.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: Accessible Menus 1

Introduction 1

What does it do? 1

Screenshots 2

Users manual 2

Adminstration 2

Upgrading from cron_autoaccesskeys 2

Hook 3

Configuration 3

Known problems 4

To-Do list 4

Changelog 4

Introduction

What does it do?

With this extention you can generate accessible (i.e. “barrierefrei”) text-based menus.

Automatically generates “accesskeys” to the navigational <A> Tags for your TMENU's based on the title of the menu item.

Prefixes each MENUITEM with a <dfn> tag showing the current nesting level

For accesskeys:

The first not yet used character of the title will be used as an accesskey. Optionally you can wrap something around the first occurence of the accesskey in the title, so you can easily simulate Windows-like menus (underlined accesskey).

This also works together with gov_accesskey, in that if an accesskey is defined for an page (field “accesskey”), it will be used instead of auto-generating one.

Please note that the usage of accesskeys isn't really recommended anymore because of the lack of a standard behaviour amongst browsers. Refer to this article (german only) for more information.

For dfn:

The nesting of your HMENU will be used as a base of the generated <dfn> tags. So on the second level, the third menu item will get a <dfn>2.3:</dfn> prepended.

This is based on a script by Jan Wischnat, from schwangau.de.

Screenshots

img-1

Users manual

The user don't need to do anything.

If the gov_accesskey extention is installed, the user that adds content should fill the “accesskey” for a page only if he wants the accesskey to be statically set (i.e. not automatically generated from the title). Otherwise, just leave that field empty.

Adminstration

If you want users to be able to override accesskeys manually, install gov_accesskey. The user will be able to override the accesskey per page.

To use the accessibility features for some menu, install the cron_autoaccesskeys extention and add a call to “user_cronaccessiblemenus->makeAccessible” on the TMENU's IProcFunc. Activate the .dfn or .accessKeys feature as you like.

((generated))

EXAMPLE

Generates a nested list menu:

temp.listMenu = TMENU
temp.listMenu {
  wrap = <ul> | </ul>
  noBlur = 1
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.accessKeys = 1
  IProcFunc.dfn = 1
  NO {
    allWrap = <li> | </li>
    stdWrap.htmlSpecialChars = 1
  }
  ACT = 1
  ACT {
    wrapItemAndSub = <li class="act"> | </li>
    stdWrap.htmlSpecialChars = 1
  }
  RO = 0
}

This will generate a menu. Each A-Tag will get an “accesskey”. First the accesskey from gov_accesskey will get used. If this is empty (“”), the cron_autoaccesskey extention will generate the accesskey on its own. Each item will be prepended with a <dfn> tag with the current nesting level.

Upgrading from cron_autoaccesskeys

If you use cron_autoaccesskeys, this extention will replace that one. To upgrade, just install the new extention and change your menu's in your TypoScript template:

Before (with cron_autoaccesskeys):

IProcFunc = user_cronautoaccesskeys->addAccessKeys

After (with cron_accessiblemenus):

IProcFunc = user_cronaccessiblemenus->makeAccessible
IProcFunc.accessKeys = 1
IProcFunc.dfn = 1

Hook

The makeAccessible function can be extented by other extentions using the included hook.

Create a function that will transform the menuArray (and return it!)

Add a hook to cron_accessiblemenus:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/cron_accessiblemenus/class.user_cronaccessiblemenus.php']['makeAccessible']) = <function>

Your function will be called with one parameter only: an array with a 'cObj' item, which will be a reference to the calling object. This will have a property called 'menuArray' and another called 'conf', with which you can work with. Don't forget to return the (possible transformed) menuArray!

Example : This will do nothing at all:

function user_AccessibleMenu { $parms}  {
  return $parms['cObj']->menuArray;
}

Configuration

The IProcFunc can be configured with the following options:

dfn

Property

dfn

Data type

boolean

Description

Activate the generation of <dfn> tags

Default

0

dfn.menuSet

Property

dfn.menuSet

Data type

string

Description

Set this to the same value to keep the counter across multiple TMENU's. Without a menuSet, each TMENU's dfn-count starts with “1”.

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.dfn = 1
  IProcFunc.dfn.menuSet = mainmenu
  ..
}

Use this, for example, if you compose your menu in a COA of different HMENU's. Use this TMENU in all your HMENU's that you use to compose your “mainmenu”, and the counter will be continue across them. The counter will also respect the nesting level.

Default

dfn.start

Property

dfn.start

Data type

integer

Description

Start the dfn counter for this level at a different value. This will also respect dfn.menuSet, so that the counter will just start at this value in the first TMENU of a set.

Default

1

dfn.stdWrap

Property

dfn.stdWrap

Data type

+stdWrap

Description

Pass the generated value through the stdWrap function. This allows you to add a prefix or suffix to your dfn.

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.dfn = 1
  IProcFunc.dfn.stdWrap.noTrimWrap = |1.| |
  ..
}

This will prefix the dfn content with “1.” and suffix it with a “space”.

Default

dfn.inATag

Property

dfn.inATag

Data type

boolean

Description

If set to true, it will place the <dfn> tag inside the <a> tag, if present. Default behaviour (false) is to place the <dfn> tag right after the <li> tag. Refer to this article (german only) for more information on when to use which method.

Default

0

accessKeys

Property

accessKeys

Data type

boolean

Description

Activate the addition of accesskeys

Default

0

accessKeys.noAutoGenerated

Property

accessKeys.noAutoGenerated

Data type

boolean

Description

Deactivates the auto-generation of access-keys. Set this to true to get only the access-keys set in the gov_accesskey field.

Default

0

accessKeyWrap

Property

accessKeyWrap

Data type

wrap

Description

The first occurrence of the accesskey in the title will get this wrap wrapped around it. Useful to highlight the accesskey of a menu item.

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.accessKeyWrap = <span class="accessKey"> | </span>
  ..
}

Default

appendWrap

Property

appendWrap

Data type

wrap

Description

This will get appended to the title, wrapping around the used accesskey.

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.appendWrap = <span class=”hidden”>&nbsp;(ALT- | )</span>
  ..
}

Default

forbiddenKeys

Property

forbiddenKeys

Data type

string

Description

A comma separated list of characters that should never be used in auto-generated accesskeys. This is useful if you already have a couple of accesskeys being used in your main template and don't want other menu items to use them (e.g. ALT-0 to go to the start page).

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.forbiddenKeys = 0,D,B,A,F,X
  ..
}

Default

((generated))

((generated))
Examples

This will generate a simple text-based menu with accessible features (dfn and accesskeys):

temp.listMenu = TMENU
temp.listMenu {
  wrap = <ul> | </ul>
  noBlur = 1
  IProcFunc = user_cronaccessiblemenus->makeAccessible
  IProcFunc.accessKeys = 1
  IProcFunc.dfn = 1
  IProcFunc.accessKeyWrap = <span class="accessKey"> | </span>
  IProcFunc.appendWrap = <span class=”hidden”>&nbsp;(ALT- | )</span>
  IProcFunc.forbiddenKeys = 0,D,B,A,F,X
  NO {
    allWrap = <li> | </li>
    stdWrap.htmlSpecialChars = 1
  }
  ACT = 1
  ACT {
    wrapItemAndSub = <li class="act"> | </li>
    stdWrap.htmlSpecialChars = 1
  }
  RO = 0
}

Here, the current accesskey will be highlighted in the title (CSS- class “accessKey”) and an accessible text will be appended to the title (ALT-<accesskey>). The keys 0, D, B, A, F, X will never be used for auto-generating, only if the user explicitly set them with gov_accesskey.

Known problems

If you override an accesskey with gov_accesskey later in the menu, it might already have been used, so it will be double-booked.

To-Do list

Nothing so far

Changelog

0.1.0 : First public version (cron_autoaccesskeys)

0.2.0 : (cron_autoaccesskeys)

  • Added forbiddenKeys option
  • Will now render the accesskey provided by gov_accesskey, if one is set. So you now don't need to patch TYPO3 anymore to get accesskeys working.

0.3.0 : renamed to cron_accessiblemenus and added <dfn> functionality and hook

0.4.0 :

  • added dfn.menuSet settings, which allows to continue the counter in the <dfn> across multiple TMENU's.
  • added dfn.stdWrap setting to be able to wrap something around the dfn-content.
  • added dfn.start setting to be able to start counting from another number

0.5.0 :

fixed documentation

fixed: Now it won't break any stdWrapped “page.meta.<>” setting anymore (e.g. mc_autokeywords).

0.6.0 :

added: new option accessKeys.noAutoGenerated to use only gov_accessible access-keys (suggestion by Bjoern Kraus)

changed: no hardcoded “:” after the dfn anymore. You can add the “:” or any other string after the dfn value using the dfn.stdWrap property (suggestion by Bjoern Kraus)

0.7.0 :

  • added: new option dfn.inATag (suggestion by Ingo Renner)
  • updated: documentation now discourages the usage of accesskeys, linking to an article about accessible menus (suggestion by Ingo Renner)

img-2 EXT: Accessible Menus - 5