-
Notifications
You must be signed in to change notification settings - Fork 87
refactor!: update popover overlay to use native popover #9785
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
1580e0d to
c5e6551
Compare
|
|
||
| root.innerHTML = ` | ||
| <button>I have a popover</button> | ||
| <vaadin-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.
Added a nested popover to verify that dragging dialog while popover is opened doesn't hide popover overlay below the dialog one (which was originally reported at #8521).
|
|
||
| const button = document.createElement('vaadin-button'); | ||
| button.textContent = 'Apply'; | ||
| const nested = document.createElement('vaadin-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.
Added a nested popover to make it easier to test different combination of triggers.
| if (target) { | ||
| const parent = getClosestOverlay(target); | ||
| if (parent) { | ||
| setNestedOverlay(parent, opened ? this : null); |
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 is no longer needed and I'll create a separate PR for removing setNestedOverlay helper altogether.
Calling bringToFront() for dialog when it has a popover open won't do anything since #9773.
c5e6551 to
f4a0321
Compare
| return; | ||
| } | ||
|
|
||
| // Copy custom properties from the owner |
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 is no longer needed as offset custom CSS properties will inherit to the overlay via cascade.
| }); | ||
| }); | ||
|
|
||
| describe('bring to front', () => { |
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.
Corresponding logic related to setNestedOverlay() was removed as no longer needed.
| }); | ||
| }); | ||
|
|
||
| describe('modeless dialog', () => { |
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.
These tests don't make sense anymore: even if bringToFront() sets higher z-index on the overlay, the popover will still be shown on top of it because it's using popover, and the dialog currently does not.
I'll create a separate issue to add a new logic for bringing nested overlays to front and then re-add ITs.
| return; | ||
| } | ||
|
|
||
| if ((this.__hasTrigger('focus') && this.__mouseDownInside) || this._overlayElement.contains(event.relatedTarget)) { |
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.
Changed this._overlayElement.contains with this.contains here and elsewhere which seems correct: in case of moving focus by the browser Tab logic, the relatedTarget is vaadin-popover itself.
|
|
||
| /** | ||
| * String used to label the overlay to screen reader users. | ||
| * String used to label the popover to screen reader users. |
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.
We could probably deprecate accessibleName and accessibleNameRef or even remove them in favor of regular aria-label and aria-labelledby, respectively (and remove overrides from the Flow counterpart).
|
|
||
| // If no user ID is provided, set generated ID | ||
| if (!this.id) { | ||
| this.id = this.__generatedId; |
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.
We could also add a mutation observer that would check if the user ID is removed and then set a generated one. Not sure if that's a common case, maybe we should create a follow-up issue and do it separately.
e00cbf0 to
d1bd34f
Compare
3ffd864 to
5d87b70
Compare
|
|
||
| const popoverOverlay = css` | ||
| :host { | ||
| --_default-offset: 0; |
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.
Aligned the custom CSS property name with the one used in base styles.
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
|
|
This ticket/PR has been released with Vaadin 25.0.0-alpha3. |



Description
Fixes #9713
This changes the
vaadin-popoverto render content to itself. We can therefore consider deprecatingrendererproperty and Lit directive and possibly update Flow counterpart to just use regular slotted content.Note: snapshot tests for this component are missing, I'll add them in a follow-up PR.
Type of change