-
Notifications
You must be signed in to change notification settings - Fork 280
refactor(ui5-popover): Keep popup open if focus is inside #1937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
|
|
||
| if (!preventFocusRestore) { | ||
| if (!this.preventFocusRestore && !preventFocusRestore) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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,
});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
Another PR to address the "QuickCardView" topic. The change keeps the Popover open, without an opener, if the focus is inside that popover.
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