gorgias/gorgias-chrome — pull request #74 by ghinda (2014-12-05 21:37:35+00:00)
Title: Refactor Tab/dialog completion functionality

Refactor the completion functionality for both keyboard (Tab-based) and using the dialog, to not have to prevent the default events on the elements. This fixes the issue of focusing on the next field by using the Tab key, when we don't want to use a quicktext.

The trick that the focus is restored to the element on which the completion was triggered on, if a quicktext was found for it. The re-focus delay is practically unnoticeable.

The refactoring also cleans up a lot of older functionality that is no longer-required like `focusNext`, `cursorPosition.element`, `cursorPosition.inCompose`, etc..

It also fixes some bugs related to setting the start and end on the Range element, when using the quicktext in a `contenteditable` element.