Skip to content

fix(cdk/overlay): support SVG element as overlay origin - #18595

Merged
andrewseguin merged 7 commits into
angular:masterfrom
jpzwarte:cdk-overlay-svg-origin
Mar 12, 2020
Merged

andrewseguin merged 7 commits into
angular:masterfrom
jpzwarte:cdk-overlay-svg-origin

Conversation

@jpzwarte

Copy link
Copy Markdown
Contributor

Currently when you provide an SVGElement when calling flexibleConnectedTo(...), 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 of HTMLElement. 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 an HTMLElement or ElementRef are supported either).

@googlebot

Copy link
Copy Markdown

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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla label Feb 24, 2020
@jpzwarte

Copy link
Copy Markdown
Contributor Author

@googlebot I fixed it.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Feb 24, 2020

@crisbeto crisbeto left a comment

Copy link
Copy Markdown
Member

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.

@crisbeto crisbeto left a comment

Copy link
Copy Markdown
Member

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.

@crisbeto crisbeto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Feb 25, 2020

@jelbourn jelbourn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mirceapop89

Copy link
Copy Markdown

Any chance for this fix to be included in v7 or v8?

@jpzwarte

Copy link
Copy Markdown
Contributor Author

Any chance for this fix to be included in v7 or v8?

Workaround is to pass an ElementRef as origin instead of an Element directly.

@mirceapop89

Copy link
Copy Markdown

Any chance for this fix to be included in v7 or v8?

Workaround is to pass an ElementRef as origin instead of an Element directly.

Ah great, thanks for the tip!

@andrewseguin
andrewseguin merged commit 09f5476 into angular:master Mar 12, 2020
andrewseguin pushed a commit that referenced this pull request Mar 12, 2020
* Support SVG elements as overlay origin.

* Review.

* Cleanup.

* Missing semicolon.

* Review.

* Remove describe.

* Rename.

Co-authored-by: Jeroen Zwartepoorte <jeroen.zwartepoorte@iddinkgroup.com>
(cherry picked from commit 09f5476)
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release

6 participants