-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(cdk/overlay): support SVG element as overlay origin #18595
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@googlebot I fixed it. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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 have some tests for using a point as an origin, so you should be able to copy and adjust those to cover an SVG element.
src/cdk/overlay/position/flexible-connected-position-strategy.spec.ts
Outdated
Show resolved
Hide resolved
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 to go once the last comments are addressed.
src/cdk/overlay/position/flexible-connected-position-strategy.spec.ts
Outdated
Show resolved
Hide resolved
src/cdk/overlay/position/flexible-connected-position-strategy.spec.ts
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
LGTM
Any chance for this fix to be included in v7 or v8? |
Workaround is to pass an |
Ah great, thanks for the tip! |
* Support SVG elements as overlay origin. * Review. * Cleanup. * Missing semicolon. * Review. * Remove describe. * Rename. Co-authored-by: Jeroen Zwartepoorte <[email protected]> (cherry picked from commit 09f5476)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently when you provide an
SVGElement
when callingflexibleConnectedTo(...)
, it will not use the bounding client rect in the_getOriginRect()
method, causing the overlay to appear at the top left of the viewport.This 1-liner fixes that by checking whether origin is an instance of
Element
instead ofHTMLElement
. No other changes are required.I looked at
flexible-connected-position-strategy.spec.ts
, but i didn't see an obvious place to add a test (i did not see any tests checking if specifiying anHTMLElement
orElementRef
are supported either).