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.

bug: popover alignment property renders incorrect location in frameworks

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

When using various combinations of side and alignment on an inline ion-popover, the popover renders at the incorrect location when opened. This occurs in all three framework integrations (Angular/React/Vue), but not in core.

The linked repo has buttons for all combinations of side and alignment; here are the specific issues I noticed:

  • side="top" shows the popover too low, overlapping the button. This occurs with all values of alignment, including when it isn’t set at all. side top, alignment start
  • For sides of right, left, start, and end, and an alignment of center, the popover is rendered a pixel or two lower than the top edge of the button, when it should be vertically centered. side left, alignment center
  • For the same sides as the above, and an alignment of end, the popover is also rendered a few pixels lower than the button’s top edge (slightly lower than with alignment="center"), when it should be raised higher so the bottom edges align. side left, alignment end

Expected Behavior

Here are corresponding screenshots from the position test in core, which shows the correct behavior:

side top, alignment start side left, alignment center side left, alignment end

Steps to Reproduce

  1. Clone repo (note the branch), npm install, ionic serve
  2. Click buttons corresponding to described side/alignment values (headers list side, then alignment)

Code Reproduction URL

https://github.com/amandaejohnston/sandbox-ionic-angular/tree/popover-positions

Ionic Info

[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module '@capacitor/ios/package'

       Require stack:
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\index.js
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\lib\index.js
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\index.js
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic
[WARN] Error loading @capacitor/android package.json: Error: Cannot find module '@capacitor/android/package'

       Require stack:
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\index.js
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\lib\index.js
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\index.js
       - C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic

Ionic:

   Ionic CLI                     : 6.18.1 (C:\Users\moogl\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.1.6
   @angular-devkit/build-angular : 12.1.4
   @angular-devkit/schematics    : 12.2.14
   @angular/cli                  : 12.1.4
   @ionic/angular-toolkit        : 4.0.0

Capacitor:

   Capacitor CLI      : 3.3.3
   @capacitor/android : not installed
   @capacitor/core    : 3.3.3
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 1.5.0

System:

   NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 8.1.0
   OS     : Windows 10

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
piotr-czcommented, Oct 7, 2022

@Lechevallier As You have written, might be that the content of .popover-content element isn’t visible at the time when calculation is being made and so it’s dimensions are being retrieved as 0px x 0px

0reactions
Lechevalliercommented, Nov 26, 2022

Thanks for the fix! 🙏 It works like a charm now 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
10 Most Common Bootstrap Mistakes That Developers Make
Common Bootstrap Mistake #1: Basic misconceptions about the framework · Common Bootstrap Mistake #2: Thinking that you don't need to know CSS to...
Read more >
Change Log - Ant Design
2022-12-12. Fix FloatButton tooltip property is not support 0 value. ... #39130; Fix message position not correct in RTL.
Read more >
Changelog | MapSVG
fix: filter fields alignment; fix: search by zip; fix: incorrect height of containers in tabs ... Feature Show rendered WP post in Details...
Read more >
Validation - Lightning Design System
Warning Icon; Warning Popover; Hiding Alerts on the Canvas; Invalid Components; Confirmation Modal; Popover/Icon Auto-Display; Error Icon; Error Popover ...
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