fix for focused element lost on redraw - close #820