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
Dropdown append to body #1012
Comments
Coming from this issue: #584 (comment) |
I also need something like this. Any progress on it? |
would really love this feature - constantly getting caught with dropdowns under other elements.... |
Really needing this feature :( |
I need this feature as well. Can I help with the implementation of this? |
My most common use case for dropdown-append-to-body is for building dropdown links in navbars. Does anyone know a workaround for that? |
I really need this feature. Any word on when this will be addressed? |
+1 |
1 similar comment
+1 |
Does anyone have a workaround for that? |
+1 |
2 similar comments
+1 |
+1 |
+1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
This is a very important feature for dropdown component. Stacking context is big concern and a problem very hard to solve when working with complex data-grids and such. I loved it how I was able to use the popover component with such ease. If you could use the same utility here it will be awesome! |
@adamk33n3r Sorry for the late reply. I was away on vacation. For me the import works just fine. I don't remember doing anything special. Does you installation contain this file? If not, have you tried reinstalling ng-bootstrap? |
@jingzhang Yes I have that file. It "imports" correctly. It's just that it's not compiling it to es5. It gets put into my bundle as es6 with imports and in Chrome it errors. |
@adamk33n3r without seeing the actual code it's hard to guess the issue. But I think my project is also complied into es6 (not sure if the correct way to call it. I'm not really an expert in typescript). BTW, my project was created with angular CLI, if yours wasn't, maybe it has something to do with the error. Sorry I couldn't be of much help. |
@adamk33n3r RE:
check if you have properly added |
I am having trouble with the @jingzhang solution on ng-bootstrap 3.0.0. I've copied the code as a new directive, imported this directive in the
|
@certainlyakey are you sure you upgraded to 3.0.0? Because dropdown.closeFromOutsideEsc() method no longer exists in this version (you can just remove the event listener on menuWrapper) |
Yes, |
OK, that's strange. I asked because with closeFromOutsideEsc in the code it shouldn't even compile. Anyway, I suspect it's due to the way you worked around the path issues. I see this at the top of your code: import { NgbDropdownMenu, NgbDropdown } from '@ng-bootstrap/ng-bootstrap/esm5/dropdown/dropdown';
import { positionElements } from '@ng-bootstrap/ng-bootstrap/esm5/util/positioning'; I had similar import issues after upgrading to 3.0.0. What I did was: import { NgbDropdown, ɵl as NgbDropdownMenu } from '@ng-bootstrap/ng-bootstrap';
import { positionElements } from '../ngb/positioning'; Notice that you need to make a local copy of the positioning service, because it's no longer exported in 3.0.0. You can grab it from here: https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/util/positioning.ts I saved it at /src/app/ngb/positioning.ts, hence the path above |
Thanks @jingzhang! It works now. Apparently there were some problems with import paths indeed which strangely weren't reported by Typescript on build. I've made an only change of modifying a single line in Thanks again for the help! |
NP @certainlyakey And thanks for sharing the fix 👍 I didn't notice that |
In release 3.1,
Code should change to |
This workaround breaks tab navigation and accessibility. We still very much need an official solution. Can't believe this is still not a thing. |
We use bootstrap 3.2 and use custom directive. Maybe it'll help someone.
We had to move positioning.ts to out app because it wasn't compiled. |
Using bootstrap 4 and related ngBootstrap, still no support for this. Maybe make this an higher priority after 2 years of this issue being open?
This solution works in putting the div under Also the div don't follow the button anymore if you scroll the page, it stay in the place it has opened (which is a problem shared by the original |
I just copied your code and everything works fine. Good job Thanks :) |
Most angular 2+ components I've seen/used have an |
Quite a pity that this issue hasn't yet received an official fix :( |
Regarding the ngb-datepicker, the attribute container="body" can be used on the input. |
Facing some issue when parent div overflow is set to |
Any progress with this issue? |
Any progress... ? |
@EvaSky workaround is working for me. if you don't update from version 2 the positioning util is not private and you can import it. otherwise you have to make a copy in your app (which sucks) |
Very pity that this issue does not seem to be of any priority to the team :( |
Agree it's very pitty, please add this input |
Bug description:
Support for dropdown append-to-body.
Use case
In a list inside an overflowed element, the dropdown is shown "inside" the main element, and you cannot seen it completely.
Working with ng1 version:
Thanks!
The text was updated successfully, but these errors were encountered: