Typeahead z-index problem when used inside Modal
See original GitHub issueBug description:
When using container="body"
on Typeahead, and placing Typeahead inside Modal, I am seeing the Typeahead’s dropdpown appear behind the Modal in the z-index order. (Typeahead dropdown z-index is 1000 while Modal is 1050).
Please see the attached Stackblitz.
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-7dfepa
- Open the modal by clicking “Launch Demo Modal”
- Interact with the first Typeahead (type “te”) - notice it works fine
- Interact with the second Typeahead (type “te”) - noticed there is no dropdown visible on the screen. Using Chrome Element Inspector we can see that the
<ngb-typeahead-window>
appended to body has a class of.dropdown-menu
setting thez-index
of 1000 (below the modal of 1050). - Push down arrow key of keyboard, then enter key of keyboard, to select invisible 1st option of Typeahead.
- Interact with the Dropdown, notice it works correctly, this also is using
container="body"
, I see a dynamically added z-index on the element style, presumably by ngb code.
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 9.1.0
ng-bootstrap: 6.1.0
Bootstrap: 4.3.0
Thanks
Thank you team, we ❤️ ng-bootstrap lib!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Bootstrap typeahead not Working inside the Bootstrap Modal
php and task. js but it seems that the typeahead is not working inside the bootstrap modal. $(document). ready(function(){ $("#assign_to").
Read more >Bug - autocomplete dropdown lists now z-indexed behind modal
I finally updated from 3.2 to 3.7. 1, and now all autocomplete dropdown lists appear behind the modals they are in.
Read more >Using Bootstrap's typeahead from inside a modal window
How you can go about using Bootstrap's typeahead in a modal window. ... in your text editor of choice and then add a...
Read more >AutoComplete Z-Index Problem / Firefox - MSDN
I have set z-index both by using the CompletionListCssClass property, and by setting a z-index on the Id generated by asp.net for the...
Read more >UI 04: Modal Implementation using position, z-index - Medium
UI 01: Autocomplete Implementation using Javascript, Html, CSS ... However, there is still a problem: The modal can not be displayed in the...
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
As a temporary workaround, I am applying the following CSS at the global level
@benouat would you consider adding an option for a custom CSS class to be applied to that
ngb-typeahead-window
? similar to thewindowClass
on the Modal control. With that, we could set the z-index on the typeahead inside our modal as-needed without having to influence all typeaheads as is the case with the workaround. I would be happy to work on the implementation if that’s something that could be considered. Merci 😉