question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Ionic v4] Popover viewport center positioning

See original GitHub issue

Ionic Info @ionic/angular: “4.0.0-beta.1”

Level Nice to have I think but I could live without the following feature request too 😉

Describe the Feature Request When no event is provided, the Popover will be positioned in the center of the viewport. To achieve this, the element div.popover-content will be created/set with top and left attributes

With this feature request I would suggest not to “position” the Popover in the center of the viewport but to “justify” it in the in the center of the viewport

To achieve this I overwrite the following css

ion-popover {
  div.popover-content {
      top: 50% !important;
      left: 50% !important;
      transform: translate(-50%, -50%) !important;
}

Proposal solution a. I think it would maybe make more sense per default when no event are provided to have the popover and its content justified in the center in the viewport and not positioned

b. If you don’t think that’s a good idea, could at least the top and left attributes not being added to the element itself but to a style property in oder to let us redefined these without having to use the keyword !important

Screenshot

capture d ecran 2018-08-04 a 08 29 26

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
brandyscarneycommented, Apr 4, 2019

@alphagamer7 That is a different issue than the one reported. It’s hard to help without seeing any code but it looks like you have a custom select. I would make sure that the select has position: relative applied to it. If you believe this is an issue with Ionic and not custom code, please create a new issue with steps to easily reproduce. Thank you!

1reaction
igarciadevcommented, Jul 3, 2021

Thank you @somq

@hemangshah Honestly I’m not really sure the solution I chose because it was quite some time ago, but I think I directly modified the style using the popover object.

const popover = await this.popoverController.create({ ... })
popover.style.cssText = '--width: 73vw;'

Hope this helps!

Thank you @somq , this works for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to center a popover horizontally on iOS? - Ionic Forum
Hi, I'd like to center a popover horizontally. With this code: async popupTerms() { const popover = await this.
Read more >
Positioning Ionic popovers | Damir's Corner
This positions it at the bottom with full width and no curved edges. The !important property is used with top and left properties...
Read more >
Display Ionic popover relative to element without clicking
If the event is not passed, the popover will be positioned in the center of the viewport.
Read more >
[Best solution]-Vertically Center a Bootstrap Popover to Viewport
Is positioning based on the parents element with position relative, absolute or fixed. Remove the link it's position: relative; or try position: fixed...
Read more >
ionic popover position right
ionic 4 popover example ... You can customize the popover in ionic as per your need. ... the popover will be positioned in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found