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.

feat: improve popover position customization

See original GitHub issue

Feature Request

Ionic version:

[x] 5.x

Describe the Feature Request

The current ion-popover position is only directly below the target element. Sometimes it will automatically select the location, but I hope developers can specify its location. For example: up, down, left and right, and the position of the user’s finger click (X, Y). Explanation of the position where the finger clicks: If there is an element with a large size, I want the position of the ion-popover to be the position where the user clicks the finger, rather than directly below the element with a large size.

Describe Preferred Solution

Describe Alternatives

Related Code

this.popoverController.create({
      component: PopoverComponent,
      cssClass: 'my-custom-class',
      event: ev,
      translucent: true, 
      position: 'top/right/bottom/left/focus....'
});

[position] attribute value:

  1. top
  2. right
  3. bottom (default)
  4. left
  5. focus (The focus position of the finger click)
  6. focus|top,
  7. focus|right
  8. focus|bottom
  9. focus|left

Additional Context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
liamdebeasicommented, May 10, 2021

Thanks for the issue. We have added support for this (and other popover features) in https://github.com/ionic-team/ionic-framework/pull/23258, and we plan on shipping this in Ionic Framework v6.

1reaction
cjoraschcommented, Jun 22, 2020

The offscreen logic still applies. It might work if you use a 1 pixel rectangle based on the location (vs. the target element bounds) and then pick side and offsets based on content size and window bounds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

feat: improve popover position customization · Issue #21599
The current ion-popover position is only directly below the target element. Sometimes it will automatically select the location, but I hope ...
Read more >
ion-popover - Ionic Framework
ion-popover is a dialog that appears on top of the current page. Learn about the popover UI component and CSS custom properties for...
Read more >
Tailwind CSS Popover - Flowbite
Animation #. Customize the animation of the popover component by using the utility classes from Tailwind CSS such as transition-opacity and duration-{x} ...
Read more >
iOS 16 - New Features - Apple
It's easy to customize the font, color, or placement of elements on your Lock Screen by tapping the element. Stylized date and time....
Read more >
Changing the position of Bootstrap popovers based on the ...
Here's what I'm trying to do. I want the Twitter Bootstap Popover position to be RIGHT unless the hotspot popover will be positioned...
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