fmtvp/tal — pull request #107 by rsjtaylor (2013-11-22 16:13:37+00:00)
Title: Fix for multiple blur/focus events up tree when attempting to focus curr...

...ently focussed button

setActiveChildWidget has no check to see if the widget to be set active is the currently active child.
It calls _setActiveChildFocussed(false) which will cause the child to be blurred (if currently focussed).
Later in the method it calls _setActiveChildFocussed(true) which sets the child focussed once more (this will always happen as the previous _setActiveChildFocussed(false) ensured it was blurred)

This causes a nasty bug in conjunction with Button.focus(). focus() recursively works its way up the tree, calling setActiveChildWidget(childWidget) at each node. The above bug causes each currently focussed node higher in the tree to emit both a blur and a focus event as focus is removed and instantly set back. This can make using these events for their intended purpose tricky.