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

No default absolute position defined before popover shown #44

Open
nkoterba opened this issue Dec 11, 2014 · 0 comments
Open

No default absolute position defined before popover shown #44

nkoterba opened this issue Dec 11, 2014 · 0 comments

Comments

@nkoterba
Copy link

So I am using Angular Material design for angular (which uses Flexbox for layout).

I was noticing that on the first click to show my popover, the popover was always slightly off position. Subsequent clicks correctly positioned the popover.

I found out that since no default absolute position is set on the popover and due to me using Flexbox, that when the popover's display was changed to block in the source code (which occurs BEFORE it's absolute position is determined), the UI layout displayed a browser scrollbar which then shifted the location of my element showing the popover and incorrect location values were calculated for the popup.

The simple fix I added was to just set an initial position on the popup when it's display is initially set to none:
nsPopover.js

          $popover
              .css('position', 'absolute')
              .css('top', '0px')
              .css('left', '0px')
              .css('display', 'none');

Thus, when the browser sets the popover's display to 'block' my page isn't "shifted" and the correct location of my element is calculated.

I'm posting this in case others experience a similar problem or are having issues using a layout framework (like Flexbox) and the initial positioning of the popover is slightly off.

I don't think setting this initial position would cause any other issues but I think ultimately, adding the following capabilities would be even better and may make my issue obsolete:
#1
#15

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

No branches or pull requests

1 participant