-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(popover-beta): Added popover-beta component #642
base: main
Are you sure you want to change the base?
Conversation
… popover-api ✅ Closes: COMUI-1637
Demo will be published at https://apps.inindca.com/common-ui-docs/genesys-webcomponents/feature/COMUI-1637-3 |
packages/genesys-spark-components/src/components/beta/gux-popover-beta/gux-popover.tsx
Outdated
Show resolved
Hide resolved
packages/genesys-spark-components/src/components/beta/gux-popover-beta/gux-popover.tsx
Outdated
Show resolved
Hide resolved
position: absolute; | ||
top: 0; | ||
left: 0; | ||
z-index: var(--gse-semantic-zIndex-popover); |
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.
It looks by using the native api it adds the popover to the top layer. You can see this by scrolling the container in the example file the popover
will appear over all the elements. Whereas in the stable
gux-popover it utilises the z-index
we set. I am not sure if we need this property anymore but we can maybe discuss in collab time.
From the docs : "Shows a popover element by adding it to the top layer."
https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
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.
Great catch. I'm seeing this in the docs too. I can bring it up during collab time.
this.forElement.popoverTargetAction = 'toggle'; | ||
|
||
if (this.isOpen) { | ||
this.popupElement.showPopover(); |
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.
From reading through the docs the popupElement
should have an attribute of popup
for the showPopover
to work but I could not find it.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/showPopover
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 think it's that the div that has a popover
attribute on it should work to use the showPopover
method.
packages/genesys-spark-components/src/components/beta/gux-popover-beta/gux-popover.tsx
Outdated
Show resolved
Hide resolved
.gux-arrow { | ||
position: absolute; | ||
width: var(--gse-ui-popover-anchor-width); | ||
height: var(--gse-ui-popover-anchor-height); | ||
|
||
/* 4px padding leaves some space for the shadow to bleed into */ | ||
padding-bottom: 4px; | ||
overflow: hidden; |
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 dont think this arrow is currently displaying.
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.
Looking into this now.
left: 0; | ||
z-index: var(--gse-semantic-zIndex-popover); | ||
display: inline-block; | ||
min-width: 280px; |
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.
is a token needed here ?
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.
Great catch. I'll ask the UX team.
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.
UX said they will make a new token for this: https://inindca.atlassian.net/browse/GDS-2672
<popover | ||
ref={(el: HTMLDivElement) => (this.popupElement = el)} | ||
class={{ | ||
'gux-hidden': !this.isOpen, |
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 think this styling can be removed as its probably done via , showPopover
and hidePopover
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.
So you're right that we don't need to control visibility anymore with css (I've removed the gux-hidden css for this component) but I'm having trouble checking if the popover is visible or not in this component's unit tests. Checking if gux-hidden
is present or not makes it easy to test visibility for this component but let me know if you know of another way to check if the popover is visible or not in jest.
packages/genesys-spark-components/src/components/beta/gux-popover-beta/gux-popover.tsx
Outdated
Show resolved
Hide resolved
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
@daragh-king-genesys I got the popover to hide when you scroll outside of its context container so all good now: 090b604 |
<div id="popover-target"> | ||
Example Element | ||
</div> | ||
<gux-popover position="top" for="popover-target"> |
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.
Make sure that these tests are updated to test the gux-popover-beta
component
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.
Fixed
@@ -215,6 +215,8 @@ export class GuxPopover { | |||
componentDidLoad(): void { | |||
if (this.isOpen) { | |||
this.runUpdatePosition(); | |||
} else { |
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.
Is this an unrelated change? It should be excluded from this PR
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.
Fixed
the feature branch is not building, I think because of a snapshot issue having to do with time zones. If you merge in |
✅ Closes: COMUI-1637
✅ Closes: COMUI-1637
@katie-bobbe-genesys I merged main into this branch. Is the feature branch building for you now? |
This PR came out of this other one: #627
TODO: add new UX token once UX finishes this ticket: https://inindca.atlassian.net/browse/GDS-2672
Using native popover-api with the popover-beta component. This has a breaking change which is requiring the
for
prop to be set.✅ Closes: COMUI-1637