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

[popover2] feat: add position prop for improved backcompat #4603

Merged
merged 2 commits into from Mar 24, 2021

Conversation

adidahiya
Copy link
Contributor

@adidahiya adidahiya commented Mar 23, 2021

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Improve Popover2's backwards compatibility with Popover. Originally I planned to move towards popper.js semantics in Popover2 with the upgrade to v2, where "placement" replaces "position". In practice, this distinction doesn't seem very meaningful and just makes the upgrade harder. Also there is some value in abstracting away low-level library positioning implementation details at the Blueprint API level here. So, this PR has these changes:

  • [core] feat: un-deprecate the position prop for <Popover>
  • [popover2] feat: add position prop to set the popper.js placement using an API familiar from Blueprint v3

Reviewers should focus on:

No regressions

Screenshot

@@ -116,8 +116,7 @@ export class Popover extends AbstractPureComponent2<IPopoverProps, IPopoverState
minimal: false,
modifiers: {},
openOnTargetFocus: true,
// N.B. we don't set a default for `placement` here because that would override
// the deprecated `position` prop
// N.B. we don't set a default for `placement` here because that would override the `position` prop
position: "auto",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will cause errors when placement is specified, which should be valid. we should configure this default inline during the render phase, not here as a static default prop

@@ -122,7 +123,8 @@ export class Popover2<T> extends AbstractPureComponent2<IPopover2Props<T>, IPopo
interactionKind: Popover2InteractionKind.CLICK,
minimal: false,
openOnTargetFocus: true,
placement: "auto",
// N.B. we don't set a default for `placement` here because that would override the `position` prop
position: "auto",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same problem here. it can be seen producing an error in Popover2Example

@blueprint-bot
Copy link

address self-review comments

Previews: documentation | landing | table

@adidahiya adidahiya merged commit 176ff0d into develop Mar 24, 2021
@adidahiya adidahiya deleted the ad/popover2-position branch March 24, 2021 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants