-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiSuperSelect] Add popoverProps prop #5214
Merged
cee-chen
merged 13 commits into
elastic:master
from
cee-chen:super-select-popoverClassName
Sep 28, 2021
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
611f6ea
[EuiSuperSelect] Add `popoverPanelClassName` prop
cee-chen 79a6ca9
Add unit test
cee-chen 0a7869a
Add changelog entry
cee-chen eb406ac
[REVERT ME] Add documentation test example
cee-chen 7a096b0
[PR feedback] Add popoverProps obj
cee-chen d8f56e2
Merge branch 'master' into super-select-popoverClassName
cee-chen 131ec53
[REVERT ME] update example with popoverProps
cee-chen a4a266b
Fix bug in popover.className override
cee-chen 541a548
Better documentation
cee-chen 6edbf98
[PR feedback] Remove `isOpen` prop from being
cee-chen 6ed81de
Revert documentation example
cee-chen f56dc24
[PR feedback] Changelog copy
constancecchen e4b7904
Merge branch 'master' into super-select-popoverClassName
constancecchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 Hey hey, just wanted to highlight that the
popoverProps
change ended up affecting more than I thought it would! When I reviewed the props we were passing to the underlying EuiInputPopover/EuiPopover, I realizedisOpen
andrepositionOnScroll
would need to be deprecated in favor ofpopoverProps
as well (since those get directly passed to the EuiPopover):LMK what you think. I'm a little nervous because this sorta bumps up the scope of what I wanted the PR to be (a relatively quick workaround) but the actual logic change isn't too complex, just IMO.
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.
Good catch. I actually think
isOpen
should remain in the top-level API, butrepositionOnScroll
should move topopoverProps
.It does increase complexity a bit the upgrade path is very simple so I'm ok with the scope creep.
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.
If someone passes
isOpen
at the top-level but also at thepopoverProps
level (sinceisOpen
is an accepted EuiPopover prop), which one wins? I assume the top-level prop, but is it confusing to document that / have that behave differently thanrepositionOnScroll
?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 would Omit it from
popoverProps
in the type definition. I agree with @thompsongl that we don't want to nest this prop becuase it is required to make the select operational.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'd change it to
Partial<CommonProps & Omit<EuiPopoverProps, 'isOpen'>>
The way I think about it is that
isOpen
is required for basic functionality of EuiSuperSelect and all other popover props are optional and based on context.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.
Sorry, actually, another thought.... if we don't want
popoverProps
to be a blanket popover override, then maybe we should omit passing aclosePopover
fn as well since that's handled by the parentEuiSuperSelect
. 🤷I guess I'm a little worried being selecting about what we do vs don't pass in will lead to weird edge cases with "oh we want to let you customize popover classNames, but not the actual open/close state, or the button ref, or ownFocus/initialFocus, etc..." if that's the case, I wonder if we should basically
Pick<>
the popover props we do want to allow instead of "all except for ones that we remembered".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.
Also worth noting all the other EuiPopover props that we set statically in
EuiInputPopover
that we would now be allowing users to override viapopoverProps
:eui/src/components/popover/input_popover.tsx
Lines 108 to 119 in e8407ff
Kind of following what I mentioned above, overriding
button
/buttonRef
/panelRef
could potentially lead to the component totally breaking 🤷 although it is largely self-inflicted at that pointI was more okay with this when we allowed overriding all EuiPopover props, because that meant the user was essentially completely taking over the state of the popover/dropdown, but I don't think it makes as much sense if we're taking away their control of the popover's
isOpen
as well 🤔Definitely could be I'm overthinking this though.
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.
Pick
is fine with me to limit the scope of this change but open the door to non-breaking changes later should we need to expand this API.As far as the non-negotiable props in EuiInputPopover,
className
can be merged usingclassnames
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.
After having set this down for awhile and coming back to it, I think I'm overthinking this haha 😅 I'm good with moving forward with just omitting
isOpen
+ clearly documenting that in the prop docs. We can adjust later if we run into issues or other devs voice any confusion/complaints with the API.LMK if 6edbf98 looks good to y'all as-is!
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.
Looks good to me!