From 107c1bdf4b5f180484e926d6b070fd513b6ae515 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 22 Dec 2008 09:48:25 +0000 Subject: [PATCH] Keep focus in creator field when using two-field autocomplete --- chrome/content/zotero/bindings/itembox.xml | 12 ++++++++++-- chrome/content/zotero/itemPane.js | 7 ------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index af35fed315..120fb91f02 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -504,8 +504,12 @@ } - var focusMode = 'info'; - var focusBox = this._dynamicFields; + // Move to next or previous field if (shift-)tab was pressed + if (this._lastTabIndex && this._tabDirection) + { + this._focusNextField('info', this._dynamicFields, this._lastTabIndex, this._tabDirection == -1); + } + ]]> @@ -1286,6 +1290,10 @@ var [field, creatorIndex, creatorField] = textbox.getAttribute('fieldname').split('-'); + // Stay focused + this._lastTabIndex = parseInt(textbox.getAttribute('ztabindex')) - 1; + this._tabDirection = 1; + var creator = Zotero.Creators.get(creatorID); var otherField = creatorField == 'lastName' ? 'firstName' : 'lastName'; diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js index 63807c6f4e..e69993eba3 100644 --- a/chrome/content/zotero/itemPane.js +++ b/chrome/content/zotero/itemPane.js @@ -254,13 +254,6 @@ var ZoteroItemPane = new function() { { _relatedBox.item = _itemBeingEdited; } - - - // Move to next or previous field if (shift-)tab was pressed - if (focusMode && _lastTabIndex && _tabDirection) - { - _focusNextField(focusMode, focusBox, _lastTabIndex, _tabDirection==-1); - } }