Home

# Class goog.events.KeyHandler

A wrapper around an element that you want to listen to keyboard events on.

extends goog.events.EventTarget

Instance Method Summary
| `attach((Document|Element|null) element, boolean= opt_capture)` Adds the proper key event listeners to the element.
| `detach()` Removes the listeners that may exist.

`disposeInternal()`

Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:

    MyClass.prototype.disposeInternal = function() {
    MyClass.superClass_.disposeInternal.call(this);
    // Dispose logic for MyClass
    };

| `getElement() ⇒ (Document|Element|null)` Returns the element listened on for the real keyboard events.
| `handleEvent(?goog.events.BrowserEvent e)` Handles the events on the element.
| `handleKeyDown_(?goog.events.BrowserEvent e)` Records the keycode for browsers that only returns the keycode for key up/ down events. For browser/key combinations that doesn't trigger a key pressed event it also fires the patched key event.
| `handleKeyup_(?goog.events.BrowserEvent e)` Clears the stored previous key value, resetting the key repeat status. Uses -1 because the Safari 3 Windows beta reports 0 for certain keys (like Home and End.)