Skip to content

Heading Plugin

Jon Gunderson edited this page Sep 6, 2017 · 25 revisions

TO DOs

  • Make check mark indicating selected heading bold or possibility bigger
  • Increase contrast of disabled menuitems

Overview

The Heading plugin is rendered as a menu button with a menu that provides the following items:

  • Level n: allows the user to insert a new heading, convert an existing text block to a heading element, modify the level of an existing heading element or remove the heading format of an existing heading element.

    • When the cursor is positioned on an empty line, inserts a new heading element of the chosen level.
    • When the cursor is positioned on an existing text block that is not already a heading, converts it to a heading element of the chosen level.
    • When the cursor is positioned on an existing heading element:
      • If the menu item that corresponds to the current level of the heading (denoted by a check mark) is selected, removes the heading format;
      • Otherwise, changes the level of the heading element to the chosen level.
  • Remove format: enabled only when the cursor is positioned on an existing heading element. Removes the heading format from the text block that corresponds to the cursor position.

  • Help: provides help documentation on working with headings.

Accessibility Requirements

Heading levels should convey consistent structure in the document according to the following rules:

  1. The level of the first heading should be the highest level permitted in the document.
  2. If the highest level permitted is Level 1, there should typically be only one heading of that level.
  3. Any subsequent heading should have either the same level (unless that would violate the multiple use restriction for Level 1), a higher level (again, avoiding the multiple use restriction for Level 1), or the next-lower level (without skipping any levels) in relation to the heading that precedes it.

User Interface Components

1. Menu Button

Appearance

  • Label: Heading
  • Tooltip: Select heading level
  • To the right of the label: a down arrow to indicate that the button displays a menu when activated

Behavior

When the menu button is activated it displays a menu

2. Menu

Menu items

  • Level 1 or Level 1 - Document title based on configuration
  • Level 2
  • Level 3
  • Level 4
  • Level 5
  • Level 6
  • Normal text
  • -------
  • Help (calls A11yFirst Help with param for headings)

Behavior

  • When the menu button is activated, the menu it displays contains all possible heading levels (2 through 6) but only the available heading levels are enabled.
  • Also, if the current context (based on cursor position or unambiguous selection) is an existing heading, the menu item corresponding to its level should be checked.

Example 1

There are currently no headings in the document. Menu displays only Level 2 enabled, i.e. it's the only available choice.

Example 2

The closest previous heading has level 2. Menu displays Level 2 and Level 3 enabled.

Example 3

The closest previous heading has level 3. Menu displays Level 2, Level 3 and Level 4 enabled.

Task Descriptions

Task 1 — Insert heading

User Actions

  • Position cursor on a blank line within the document.
  • Select Heading menu button: menu is displayed (see Menu — Behavior)
  • Select desired heading level from menu
  • Type heading text and optionally press return to end heading block and start a new paragraph.

Result

A new block of text formatted as a heading with the select level is created.

Task 2 — Convert an existing text block to a heading

User Actions

  • Position cursor at the beginning or end of, or within, a block of text.
  • Select Heading menu button: menu is displayed (see Menu — Behavior)
  • Select desired heading level from menu

Result

The block of text defined by the cursor location is converted to a heading element of the selected level.

Task 3 — Remove heading format from existing heading

User Actions

  • Position cursor at the beginning or end of, or within, a heading block.
  • Select Heading menu button: menu is displayed (see Menu — Behavior)
  • Select one of the following in the menu:
    • The checked Level n item, i.e., the item that corresponds to the level of the heading defined by the cursor position
    • Remove format

Result

The block of text defined by the cursor location is converted from a heading element to a plain paragraph.

Task 4 — Get help on adding headings to a document

User Actions

  • Select Heading menu button: menu is displayed
  • Select Help from menu

Result

A dialog box is displayed that contains help documentation for the Heading feature.

To Do

  • Generalize the algorithm for getAvailableHeadings to account for various configuration options.