From 595af40a8da1e8a5c1e0df0ee29e3283c33f94a0 Mon Sep 17 00:00:00 2001 From: Bill Keese Date: Wed, 7 Dec 2016 20:35:48 +0900 Subject: [PATCH] Fix regression where List doesn't remember the previously focused ListItem. Fixes #680, refs ibm-js/delite#462. --- list/List.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/list/List.js b/list/List.js index 5d25fe58f7..6d9b26f5ed 100644 --- a/list/List.js +++ b/list/List.js @@ -992,8 +992,7 @@ define([ }, /** - * @method - * Handle keydown events + * Handle keydown events. * @private */ _keynavKeyDownHandler: dcl.before(function (evt) { @@ -1027,15 +1026,14 @@ define([ } }, - /** - * @method - * Called on "delite-deactivated" event, stores a reference to the focused child. - * @private - */ - _keynavDeactivatedHandler: dcl.superCall(function (sup) { - return function () { - this._previousFocusedChild = this.navigatedDescendant; - sup.call(this); + focusoutHandler: dcl.superCall(function (sup) { + return function (evt) { + // When focus moves outside of the List, save reference to previously focused child. + if (!this.contains(evt.relatedTarget)) { + this._previousFocusedChild = this.navigatedDescendant; + } + + sup.apply(this, arguments); }; }),