Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[EuiFlyout] Scope close events to mask when
ownFocus=true
#5876[EuiFlyout] Scope close events to mask when
ownFocus=true
#5876Changes from 3 commits
9805148
559d42c
2e440ff
ca8f0fe
6b8df0c
5d2f52e
e635a85
0dbcf3d
d017609
43ce709
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This still feels pretty hard for me to read personally 😅 Since this is a function now, can we prefer early returns?
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'll refactor for readability, but here's the logic:
ownFocus=true
(default), only clicks on the mask should close the flyout, even ifoutsideClickCloses=true
ownFocus=false
, the flyout will only close ifoutsideClickCloses=true
, and in that case clicking any external element will close the flyoutThere 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.
That's just not what the current branching is doing though?? So you'd need to change this logic if that's the behavior you want.
outsideClickCloses === true
will always evaluate to returningonClose()
. Am I reading this the same way as you?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.
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.
Yep I had the conditional wrong. #5876 (comment) is correct; will push the change once we get confirmation from @cchaos
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.
@thompsongl Nice! Definitely much easier to grok now, especially w/ comments. For the last comment/return, I might make it a bit more specific to help follow the possible branch paths:
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 also think we should be more specific about the
isDefaultConfiguration
mask behavior:It's not that the business logic/UX doesn't make sense, it's just that it's a bit tortuous so more comments should help with that (I 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.
Oh man, I remember how tricky this logic was. I'm going to repeat the logic just to ensure I understand.
ownFocus = true
: The overlay mask renders and the flyout will only be closed when clicking mask (or close button)ownFocus = false && outsideClickCloses = false
: No overlay mask and can only be closed via close button (or some other in-page toggle)ownFocus = false && outsideClickCloses = true
: Clicking anywhere outside will close flyout (does this include dragging with mouse up or does this now mean a special extra configuration?)I feel like that's how it was before, but maybe I'm remembering another config wrong?
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.
By default the close event will happen if mousedown happens outside the flyout. Consumers can change this to occur on mouseup if they have some reason to do so.
By default the close event will not happen if mousedown happens inside the flyout, even if mouseup happens outside the flyout (e.g., mousedown inside, drag outside, release. The flyout remains open)
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.
43ce709 incorporates all suggestions in this thread