Skip to content

Conversation

@ilhan007
Copy link
Contributor

@ilhan007 ilhan007 commented Jul 9, 2020

Another PR to address the "QuickCardView" topic. The change keeps the Popover open, without an opener, if the focus is inside that popover.

  • add prevent-focus-restore protected property in addition to the preventFocusRestore param of Popup.prototype.close method, because the quickCardView might close due to user interaction - click, TAB, ESC.
  • remove the recently added _closeWithOpener param, as now the popover without an opener would remain open if the focus is inside it and will be closed otherwise.

QuickCardView Interaction (test it on http://localhost:8080/test-resources/pages/Input_quickview.html)

  • Once opened, both Suggestions Popover and QuickCardView will close if:
    neither the SearchField nor the QuickCardView has the focus, because the user clicks somewhere outside or
    the user uses the TAB | SHIFT + TAB and the focus is somewhere else

  • Once opened, the QuickCardView remains open and Suggestions Popover closes if:
    the focus moves to the QuickCardView, because the Popover.prototype.applyFocus method is called,
    the user clicks inside the QuickCardView or the user uses the TAB | SHIFT + TAB key and the focus is goes inside the QuickCardView

Related to: #1768

}

if (!preventFocusRestore) {
if (!this.preventFocusRestore && !preventFocusRestore) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need the third parameter to close any more. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the TextArea, the Input and InputSuggestions classes make calls like: close(false, false, true).

I think there are cases we want the focus to be restored, and to prevent it on some interactions within the TextArea and the Input. On the other hand to make this quick card view popover behave as expected it should have this prevent-focus-restore always.

But, I will definitely check if it is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to replace two calls of "close(false, false, true)" in the TextArea and the Input, both related to the valueStateMsg popover, But one in the InputSuggestion is conditional:

Here we should restore the focus, when suggestion is selected, otherwise - prevent it.

this.Suggestions.toggle(shouldOpenSuggestions, {
   preventFocusRestore: !this.hasSuggestionItemSelected,
});

@ilhan007 ilhan007 requested a review from vladitasev July 16, 2020 12:00
@ilhan007 ilhan007 merged commit 45cdcc2 into master Jul 17, 2020
@ilhan007 ilhan007 deleted the refactor-popover branch July 17, 2020 13:18
ilhan007 added a commit that referenced this pull request Jul 17, 2020
Another PR to address the "QuickCardView" topic. The change keeps the Popover open, without an opener, if the focus is inside that popover.

add prevent-focus-restore protected property in addition to the preventFocusRestore param of Popup.prototype.close method, because the quickCardView might close due to user interaction - click, TAB, ESC.
remove the recently added _closeWithOpener param, as now the popover without an opener would remain open if the focus is inside it and will be closed otherwise.
QuickCardView Interaction (test it on http://localhost:8080/test-resources/pages/Input_quickview.html)

Once opened, both Suggestions Popover and QuickCardView will close if:
neither the SearchField nor the QuickCardView has the focus, because the user clicks somewhere outside or
the user uses the TAB | SHIFT + TAB and the focus is somewhere else

Once opened, the QuickCardView remains open and Suggestions Popover closes if:
the focus moves to the QuickCardView, because the Popover.prototype.applyFocus method is called,
the user clicks inside the QuickCardView or the user uses the TAB | SHIFT + TAB key and the focus is goes inside the QuickCardView

Closes: #1768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants