Nebular: Opening NbSelect distorts page layout

Created on 29 Apr 2019  路  16Comments  路  Source: akveo/nebular

Issue type

I'm submitting a ... (check one with "x")

  • [X] bug report
  • [ ] feature request

Issue description

Current behavior:
If you have nb-layout-header on a page and nb-select inside nb-layout-column and if page's height is bigger than your screen and you open the nb-select after scrolling, the nb-layout-header would disappear.
(NOTE:) - the parent component nb-layout has no input properties.

Expected behavior:
nb-layout-header shouldn't move or disappear after scrolling the page and opening the nb-select

Steps to reproduce:
create nb-layout then inside it one nb-layout-header and one nb-layout-column. Then put a div Inside nb-layout-column with a height bigger than the screen, so you can to scroll it then put a nb-select inside this div in a position that you have to scroll in order to get to it, then open then nb-select to see the issue.

Related code:
Please refer to this closed issue - #1158

Angular, Nebular

Angular - 7.3.7
Nebular - 3.5.0
bug components

Most helpful comment

negative top margin is added to the html element when select component is clicked. I added the following now to have quick fix:
html {top: 0 !important;}

All 16 comments

The bug made the NbSelect component unusable. The closed referenced issue does not solve the bug.

Looking forward for workaround
Thanks

Yep, this issue is still happening, in the official demo and in my app. NbSelect is breaking the layout. When a nb select is opened with the window scrolled down, the html element style attribute is changed applying negative top css property to it. This pushes the header too, and in my app, the nb-menu element.

For now, I fixed it with:

/deep/ nb-layout.with-scroll .scrollable-container {
  height: auto !important;
}

negative top margin is added to the html element when select component is clicked. I added the following now to have quick fix:
html {top: 0 !important;}

Same issue here... @maihannijat 's solution doesn't seem to work for me... Where do you add the html style?

Ran into the issue today, fixed with @maihannijat first fix, but using ::ng-deep instead of /deep/:

::ng-deep nb-layout.with-scroll .scrollable-container {
    height: auto !important;
}

Although that may break other scrollings, not a perfect fix.

@Meowzz95 I add the following in the index.html:

<head>
      <style>html {top: 0 !important;}</style>
</head>

Any other solutions for this one that DOESN'T break scrolling??

For now, I don't use selects from nebular, just the common bootstrap .custom-select. For my application, it doesn't matter so much, but it would be nice for it to work properply. But, it seems like Nebular had an update, as the look of the selects have changed, maybe this issue was fixed??

The issue with header should be fixed by #1604. Also, a similar issue was fixed in the sidebar by #1607. We're planning to release minor updates with this fixes tomorrow (for both latest 4.0 and LTS 3.6 versions).

Before the release, you could apply change manually to verify fix does work.

To fix header:

  1. Remove all workarounds proposed above.
  2. Add the next lines to the global styles or component containing nb-layout-header.
nb-layout-header.fixed {
  top: 0;
}

To fix sidebar:

  1. Remove all workarounds proposed above.
  2. If you use custom theming add next lines in the component containing nb-sidebar:
    nb-sidebar ::ng-deep .main-container-fixed { top: nb-theme(header-height); }
    or if case you use prebuilt css add following lines in global styles:
    nb-sidebar .main-container-fixed { top: 4.75rem; }

Please, let us know here if fixes don't work for you.

Closing as fixed in Nebular 3.6.1 or 4.1.0. If you still facing this issue, feel free to reopen.

@yggg this is when nb-select is in a dialog
Screen Shot 2020-02-13 at 10 45 08 PM

still occurs on "@nebular/theme": "4.6.0"

happens in 5.x as well

Still happening but on production build only. This is very weird

still happening in 6.0 as well, not fixed yet

I have placed an nb-select on my footer. The bug is still happening in 6.2.1. Need help!

https://user-images.githubusercontent.com/41570605/102645341-9ce84400-4162-11eb-85e3-76aa71ab4ef0.mp4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aqsdc1 picture aqsdc1  路  3Comments

ChristianVega5421 picture ChristianVega5421  路  3Comments

dragonbane0 picture dragonbane0  路  3Comments

obarazan picture obarazan  路  3Comments

henry74 picture henry74  路  3Comments