Sticky Keys Panel

Overview

Component Name: gpii.firstDiscovery.panel.keyboard

File: panels.js

The Sticky Keys panel presents an adjuster that allows the user to adjust the sticky preference settings.

The Sticky Keys panel:

  1. assesses whether the user needs the assistance of the Sticky Keys feature,
  2. provides a means for users to experiment the experience when the Sticky Keys preference is turned on or off, and
  3. turns the Sticky Keys preference on or off.

Using the Sticky Keys Panel

Option 1: In the Auxiliary Schema, specify the name of the panel as the type property of the panel section:

"keyboard": {
    "type": "gpii.firstDiscovery.stickyKeys",
    "panel": {
        "type": "gpii.firstDiscovery.panel.keyboard",
        "container": ".gpiic-fd-prefsEditor-panel-keyboard",
        "template": "%templatePrefix/keyboard.html",
        "message": "%messagePrefix/keyboard.json",
        "gradeNames": ["gpii.firstDiscovery.panel.keyboardTts", "gpii.firstDiscovery.panel.keyboard.prefEditorConnection"],
        "keyboardInputGradeNames": ["gpii.firstDiscovery.keyboardInputTts"]
    }
}

Working in conjunction with the Auxiliary Schema, the type and its default value of the Sticky Keys preference are defined in the Primary Schema:

fluid.defaults("gpii.firstDiscovery.schemas.stickyKeys", {
    gradeNames: ["fluid.prefs.schemas"],
    schema: {
        "gpii.firstDiscovery.stickyKeys": {
            "type": "boolean",
            "default": false
        }
    }
});

Option 2: Outside the context of the First Discovery Tool, developers may wish to create a standalone component:

var myPanel = gpii.firstDiscovery.panel.keyboard(container, options);

Grades

This component uses the following base grades:

Model

This component supports the following model properties:

Path Description Values Default
offerAssistance Whether or not the sticky keys feature should be offered. Boolean undefined
tryAccommodation Whether or not users select to try the sticky keys feature. Boolean false
userInput The user input. String ""

Supported Events

This component supports the following events:

Event Type Description Parameters
onOfferAssistance default Fired when the sticky keys feature is determined to be offered. none
onInitInput default Fired when it's time to initialize the keyboard input sub-component. none

Methods

Method Description Parameters
toggleAssistance Displays or hides the sticky keys assessment container. offerAssistance (boolean): a flag indicating whether or not to display the container
destroyAssessor Destroys the sticky keys assessment component. none

Subcomponents

This component has the following subcomponents:

NameDescriptionValuesDefault
assistance Used to turn on/off the sticky keys assistance. "gpii.firstDiscovery.keyboard.stickyKeysAdjuster"
assistance: {
    type: "gpii.firstDiscovery.keyboard.stickyKeysAdjuster",
    createOnEvent: "onOfferAssistance",
    container: "{that}.container",
    options: {
        messageBase: "{keyboard}.options.messageBase",
        model: {
            tryAccommodation: "{keyboard}.model.tryAccommodation",
            stickyKeysEnabled: "{keyboard}.model.stickyKeysEnabled"
        },
        listeners: {
            "{keyboard}.events.onRenderTree": "{that}.tooltip.close"
        }
    }
}
stickyKeysAssessor Used to assess whether the user needs the help of the sticky keys feature. "gpii.firstDiscovery.keyboard.stickyKeysAssessment"
stickyKeysAssessor: {
    type: "gpii.firstDiscovery.keyboard.stickyKeysAssessment",
    options: {
        requiredInput: "%",
        model: {
            userInput: "{keyboard}.model.userInput",
            offerAssistance: "{keyboard}.model.offerAssistance"
        }
    }
}
keyboardInput Used for the user input. "gpii.firstDiscovery.keyboardInput"
keyboardInput: {
    type: "gpii.firstDiscovery.keyboardInput",
    createOnEvent: "onInitInput",
    container: "{that}.dom.input",
    options: {
        gradeNames: ["gpii.firstDiscovery.keyboardInputTts"],
        model: {
            userInput: "{keyboard}.model.userInput",
            stickyKeysEnabled: "{keyboard}.model.stickyKeysEnabled"
        },
        messageBase: "{keyboard}.options.messageBase"
    }
}

Options

This component can be configured using the following options:

NameDescriptionValuesDefault
selectors Javascript object containing selectors for various fragments of the markup, including the containers for the subcomponents. See Selectors below

Selectors

One of the options that can be provided to Infusion components is a set of CSS-based selectors identifying where in the DOM different elements can be found. Components use a DOM Binder to access the named elements.

The value for the selectors option is itself a Javascript object containing name/value pairs:

selectors: {
    selector1Name: "selector 1 string",
    selector2Name: "selector 2 string",
      ...
}
Selector Name Description Default
input The input field. ".gpiic-fd-keyboard-input"
instructions The panel instruction. ".gpiic-fd-keyboard-instructions"
assistance The area for assessing and experimenting the sticky keys feature. ".gpiic-fd-keyboard-assistance"

Dependencies

<script type="text/javascript" src="src/lib/infusion/infusion-custom.js"></script>
<script type="text/javascript" src="src/js/msgLookup.js"></script>
<script type="text/javascript" src="src/js/tooltip.js"></script>
<script type="text/javascript" src="src/js/panels.js"></script>