feat: improve popover position customization
See original GitHub issueFeature 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:
- top
- right
- bottom (default)
- left
- focus (The focus position of the finger click)
- focus|top,
- focus|right
- focus|bottom
- focus|left
Additional Context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:17 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.