Skip to content
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

Merged
merged 7 commits into from
Mar 12, 2020

Conversation

jpzwarte
Copy link
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

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
Contributor Author

@googlebot I fixed it.

@googlebot
Copy link

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
Copy link
Member

@crisbeto crisbeto left a 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.

Copy link
Member

@crisbeto crisbeto left a 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.

Copy link
Member

@crisbeto crisbeto left a comment

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
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@mirceapop89
Copy link

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

@jpzwarte
Copy link
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

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 <[email protected]>
(cherry picked from commit 09f5476)
@angular-automatic-lock-bot
Copy link

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants