-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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(cdk/overlay): Allow passing separate X and Y values for the view… #29563
base: main
Are you sure you want to change the base?
feat(cdk/overlay): Allow passing separate X and Y values for the view… #29563
Conversation
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.
Can you add a couple of tests to src/cdk/overlay/position/flexible-connected-position-strategy.spec.ts
?
37b5e76
to
0903d6e
Compare
Hi, done :) |
0903d6e
to
2a78c90
Compare
Hi @crisbeto, could I get another review? Thanks! |
* Sets a minimum distance the overlay may be positioned from the left edge of the viewport. | ||
* @param margin Required margin between the overlay and the viewport edge in pixels. | ||
*/ | ||
withViewportMarginLeft(margin: number): this { |
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.
A couple of notes:
- Instead of introducing properties for each direction, we should just change the viewport margin to be something like
number | {top: number, bottom: number, start: number, end: number}
. - We should use
start
andend
, instead ofleft
andright
, because they get inverted in RTL.
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 points, I've updated the parameter to a union type as suggested as well as renamed left/right -> start/end
2a78c90
to
742668a
Compare
6804076
to
73539f2
Compare
Hi @crisbeto, I updated my tests and everything should build correctly now. Could you review again when you have time? |
@@ -0,0 +1 @@ | |||
export type ViewportMargin = number | {top?: number; bottom?: number; start?: number; end?: number}; |
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 like this file is missing a license header. You can also put the type in one of the existing files.
…portMargin The overlay directive now accepts two additional (optional parameters) [viewportMarginX] and [viewportMarginY]. You can use these to pass separate margin values for the viewport.
73539f2
to
70450b2
Compare
@crisbeto Right, sorry. I've moved it to another file now |
Is there something else I need to change for this PR? I see the merge status and internal tests are failing but I'm unable to see any details |
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 like this broke some internal screenshot tests, but I haven't had the time to debug them. In some of them an autocomplete that is close to the viewport edge was the same width as the trigger, but after the change it's slightly smaller. I suspect the margin might be getting doubled somewhere where previously it wasn't.
…portMargin
The overlay directive now accepts two additional (optional parameters) [viewportMarginX] and [viewportMarginY]. You can use these to pass separate margin values for the viewport.