Skip to content

Commit

Permalink
CHE-5274. Do not skip setting focus on element when window was alread…
Browse files Browse the repository at this point in the history
…y displayed

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
  • Loading branch information
RomanNikitenko committed Aug 16, 2017
1 parent 8aa3f5d commit 9ee14bb
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public void show(@Nullable final Focusable selectAndFocusElement) {
setBlocked(false);

if (isShowing) {
setFocusOn(selectAndFocusElement);//the window is displayed but focus for the element may be lost
return;
}

Expand All @@ -247,14 +248,22 @@ public void show(@Nullable final Focusable selectAndFocusElement) {
public void execute() {
// The popup may have been hidden before this timer executes.
view.setShowing(true);
if (selectAndFocusElement != null) {
selectAndFocusElement.setFocus(true);
}
setFocusOn(selectAndFocusElement);
}
});
}
}

/**
* Sets focus on the given element.
* If {@code elementToFocus} is {@code null}, no element will be given focus
*/
private void setFocusOn(@Nullable Focusable elementToFocus) {
if (elementToFocus != null) {
elementToFocus.setFocus(true);
}
}

private void handleViewEvents() {
view.setDelegate(new ViewEvents() {
@Override
Expand Down

0 comments on commit 9ee14bb

Please sign in to comment.