[EuiPopover] Added panelProps prop#4573
Conversation
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
|
Hey @akashgp09! Thanks for this PR but I think there was some confusion in the issue - I'll try to explain at a high level what we're looking for here and hopefull that clears it up! So, in And then instead of passing passing in |
|
@myasonik thanks for the review, now it's clear to me ^_^. I will make the changes soon . |
|
jenkins test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4573/ |
myasonik
left a comment
There was a problem hiding this comment.
This LGTM!
Will let an EUI team member review/merge.
| // Shadows are only allowed when there's a white background (plain) | ||
| const canHaveShadow = color === 'plain'; | ||
| const canHaveBorder = color === 'plain' || color === 'transparent'; | ||
|
|
There was a problem hiding this comment.
Can you just revert all changes to this file?
src/components/popover/popover.tsx
Outdated
| style={this.state.popoverStyles} | ||
| {...panelProps}> |
There was a problem hiding this comment.
The only thing about putting this prop at the bottom is that now the user can override any of the props including ones that are absolutely necessary for it display or behave well with a11y. Instead this prop should live at the top of this list and then in the state.popoverStyles account for any possible panelProps?.style and in the panelClasses, add panelProps?.className since these are allowed to be extended but we don't want the user completely overriding the internals.
src/components/popover/popover.tsx
Outdated
| aria-modal="true" | ||
| aria-describedby={ariaDescribedby} | ||
| style={this.state.popoverStyles}> | ||
| style={panelProps?.style || this.state.popoverStyles}> |
There was a problem hiding this comment.
Sorry this one isn't an or situation. Wherever the state.popoverStyles is being set, you'll need to also add panelProps?.style.
|
Jenkins, test this |
|
Looks like a type error - not sure how to resolve it from the top of my head |
src/components/popover/popover.tsx
Outdated
| !ownFocus || !this.state.isOpenStable || this.state.isClosing | ||
| }> | ||
| <EuiPanel | ||
| {...panelProps} |
There was a problem hiding this comment.
Passing {...(panelProps as EuiPanelProps)} here will resolve the TypeScript issue mentioned in #4573 (comment) - somewhere between accepting panelProps and forwarding it here TS forgets the value has been validated and appears to intersect the div & button props.
|
@cchaos @chandlerprall i have made the changes as suggested. Please let me know if there are any changes required. |
|
Jenkins, test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4573/ |
cchaos
left a comment
There was a problem hiding this comment.
👍 Changes look good to me. @chandlerprall Let us know if you're good with the panelProps.style handling.
|
I'm gonna get this merged in. We can consider deprecating those other props later, but I know they're widely used so this new prop is mostly a Jenkins, test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4573/ |
Summary
This PR Fixes: #4293
Added panelProps prop to EuiPopover
Checklist
- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes