This Wiki page is edited by participants of the HTML Accessibility Task Force. It does not necessarily represent consensus and it may have incorrect information or information that is not supported by other Task Force participants, WAI, or W3C. It may also have some very useful information.

Access/command and event

From HTML accessibility task force Wiki
Jump to: navigation, search


Command & Event Module for HTML5

About the Command & Event Module for HTML5 Proposal

  • author: Robert J. Burns
  • precis: A cascading keybinding mechanism, compatible with the XHTML Access Module. This proposal takes the powerful idea of cascade from stylesheets and applies those ideas to a cascading input device event binding mechanism where the user is ultimately in control, but where authors can provide powerful and discoverable key bindings to interact with their authored content. It also provide an alternate attribute to the "key" attribute which is fairly limited in its use of characters rather than Qnames. The use of Qnames also makes Internationalization (i18n) easier to achieve.
  • status of this page: this page is currently under construction; please bookmark and return often



Advantages of This Comprehensive Approach

First, it adds an inputevent attribute to supersede the key attribute. Whereas the key attribute takes a single character, the inputevent accepts a [ QName] that can include both characters or other names. This allows authors, users, and user agents to specify either specific device keys (independent of language) or alternately specific language dependent characters independent of the device producing them. Like the current access proposal, this proposal is primarily designed for keyboard events, but it might be also expanded to other event binding without compromising its keyboard event binding function.

Second, the proposal similarly provides for a combining modifiderkeys attribute and QName to allow device and platform independent specification of modifier keys. For example the ModifiderKeys QName "A" Indicates the primary modifier key combination for a platform. (For example, this would likely be the command key on a Mac OS system and the control key on a Windows system. The default for this attribute should be something like "A" or "B" or whatever the current access proposal specifies for the proper behavior.

Third, the proposal adds a more flexible action attribute that accepts a script expression. This serves a similar function to the current access proposals activate yes or no attribute. However, the action attribute allows authors and users to specify any action be fired upon the element designated by the targetid or targetrole attributes. It could specify focus(), activate(), or any other ScriptExpression action on the target.

Fourth, the proposal allows a src attribute to designate an external and reusable access document. This external access document can also make use of content negotiation to deliver a localized version of the access mechanism.

Finally, the proposal specifies a cascade to describe a well-defined behavior for conflicting user agent, author, and user specified input events are handled consistently and routed to the proper target and action. This means that any user agent could have its own minimal key binding expressed using a user agent access document with the important boolean attribute specified. Authors and users could then specify their own key binding and also make use of the "important" attribute to override the other key binding behavior.



Element name: access
Attributes: targetid, targetnid, targetrole, action, key, inputevent, modifierkeys
Content Model
Context Model
DOM Interface
Specialized UA Behavior
Details: EMPTY



Command & Event Module Elements

Element name: command
Attributes: Common, action, help?, hint?, label?, (handler | script)
Content Model
Context Model
DOM Interface
Specialized UA Behavior
Details

Element name: eventsource
Attributes: src, action, listener
Content Model: EMPTY
Context Model:
DOM Interface:
Specialized UA Behavior:
Details:

Element name: handler
Attributes: Common, execution
Content Model: (CDATA)*
Context Model:
DOM Interface:
Specialized UA Behavior:
Details:

Element name: script
Attributes: sync, async, defer, type, charset
Content Model: (CDATA)*
Context Model:
DOM Interface:
Specialized UA Behavior:
Details:



Command & Event Module Attributes

Note: In the following definition lists, the letter W is used to indicate a writable (read/write as opposed to readonly) DOM attribute which takes or returns a DOMString and whose name is following in parentheses (unless identical to the name of the element attribute)


access element attributes

Attribue name: targetid
Type: IDREF
Default:
DOM: W
Other UA behavior:
Details: indicates the id of an element to preform an action specified by the 'action' attribute (only one of targetid, targetnid, or targetrole should be specified)

Attribue name: targetnid
Type: NIDREF
Default:
DOM: W
Other UA behavior:
Details: indicates the nid of the next element in document order to perform an action specified by the action attribute (only one of targetid, targetnid, or targetrole should be specified)

Attribue name: targetrole
Type: QNameRef
Default:
DOM: W
Other UA behavior:
Details: indicates the role of the next element in document order to perform an action specified by the action attribute (only one of targetid, targetnid, or targetrole should be specified)

Attribue name: action
Type: URIRef
Default: focus()
DOM: W
Other UA behavior:
Details: indicates an action to perform on the targeted element

Attribue name: key
Type: Character
Default:
DOM: W
Other UA behavior:
Details: indicates a character to serve as a proxy for a matching keyboard event

Attribue name: inputevent
Type: QNameRef
Default:
DOM: W
Other UA behavior: W
Details: indicates a QName for a input device event

Attribue name: modifierkeys
Type: QNameRefs
Default:
DOM: W
Other UA behavior:
Details: indicates QNames for a single or combination of modifier keys on an input device


command element attributes

Attribue name: action
Type: URIRef
Default:
DOM: W
Other UA behavior:
Details:


eventsource element attributes

Attribue name: action
Type: QNameRef
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: src
Type: URIRef
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: listener
Type: IDREF
Default:
DOM: W
Other UA behavior:
Details:


handler element attributes

Attribue name: src
Type: QNameRef
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: execution
Type:
Default: ("sync" | "async" | "defer" | "immediate"), ("sync" | "async" | "defer" | "immediate")?
DOM: W
Other UA behavior:
Details:


script element attributes

Attribue name: sync
Type: boolean
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: async
Type: boolean
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: defer
Type: boolean
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: type
Type: ContentType
Default:
DOM: W
Other UA behavior:
Details:

Attribue name: charset
Type: Encoding
Default:
DOM: W
Other UA behavior:
Details:



Keyboard Focus Attributes Module

These attributes provide authors with fine-grained control over the keyboard focus cycle.

Keyboard Focus Attributes

Note: W is used in the following definition list to indicate a writable (read/write as opposed to readonly) DOM attribute which takes or returns a DOMString and whose name is following in parentheses (unless identical to the name of the element attribute)

Attribue name: nextfocus
Type: IDREF | NIDREF
Default: Allows implementation discretion and user default variations, but should be something like next sibling or recursively (the parent element’s next sibling), and the focus should proceed to focusable descendants first in tree-depth-first order.
DOM: W (nextFocus)
Other UA behavior: Modified HTML5 focus algorithm
Details: Since IDs and NIDs share the same namespace, it is an authoring error for both an 'id' attribute and a 'nid' attribute to share the same value within the same document. In the case of such a name conflict error, UAs must treat the value as a NIDREF (ignoring any 'id' attribute with the same value).

Attribue name: prevfocus
Type: IDREF | NIDREF
Default: Allows implementation discretion and user default variations, but should be something like the previous focusable element – applying the reverse order of the focus cycle determined by the focus algorithm.
DOM: W (prevFocus)
Other UA behavior: Modified HTML5 focus algorithm
Details: Like nextfocus, NIDREF takes precedence over IDREF in the case of authoring errors.

Attribue name: firstfocus
Type: IDREF | NIDREF
Default: Allows implementation discretion and user default variations, but should be something like the first focusable ancestor. If the element itself is focusable, focus should advance to its descendants only after the element itself has gained focus.
DOM: W (firstFocus)
Other UA behavior: Modified HTML5 focus algorithm
Details: It is an error if the value of the attribute is not a reference to a descendant element and in such cases, UAs should treat the value as if it were absent. Like nextfocus, NIDREF takes precedence over IDREF in the case of authoring errors. However, in this case both 'id' and 'nid' attributes on descendant elements take precedence over any 'nid' or 'id' attributes in ancestor elements (which must be ignored by the UA for firstfocus references).

Attribue name: focusable
Type: "true" | "false" | "auto"
Default: "auto"
DOM: W
Other UA behavior: FocusAlgorithm
Details:



Keyboard Focus Attribute Module DOM Interface

UA Processing: Modified HTML5 focus algorithm

  • if the 'focusable' attribute exists on an element and is set to a valid value, the 'focusable' attribute takes precedence over any non-positive 'tabindex' attribute values and UAs must ignore the 'tabindex' attribute (positive tabindex values declare they want to receive focus from another element with the next lowest 'tabindex' value while focus attributes indicate which element will next receive focus, so a positive tabindex value is not ignored even when a 'nextfocus' or 'prevfocus' or any other focus attribute is set; however, a positive tabindex value on an element with a valid 'nextfocus' attribute value will be ignored in determining the next focussed element.)
  • a 'tabindex' value less-than 0 is equivalent to focusable='false'
  • a 'tabindex' value equal to 0 is equivalent to focusable='nocycle'
  • HTML5 focus algorithm forms the basis for focus algorithm. The HTML4.1 focus attributes override the HTML5 defined behavior. Moreover, UAs may deviate from the recommended behaviors in the HTML5 algorithm to provide users more fine-grained preferences over focus behavior such as the list of auto focussed elements, focus of elements with specific attribute values, etc.
  • Positive tabindex attribute values alter the auto sequencing of focus attributes according to the HTML5 Sequential Focus Algorithm
  • Any element that has a 'nextfocus', 'prevfocus', or 'firstfocus' attributes with a valid value, that value overrides the HTML5 behavior.

Authoring Considerations

  • authors should use these attributes as sparingly as possible and instead allow the default UA focus algorithm to handle the focus cycle – only assigning these attributes to alter the default behavior.
  • authors are discouraged from using the legacy 'tabindex' attribute in favor of using the new focus attribute module attributes.
  • using the focus attributes module allows authors to easily copy and paste content within the same document and get consistent focus behavior (whereas 'tabindex' creates repeated conflicting attribute values)