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

Typeahead Popup Position - drop down off screen (outside view port) #1767

Closed
SauceCode84 opened this issue Aug 23, 2017 · 3 comments
Closed

Comments

@SauceCode84
Copy link

I'm using the typeahead control, which is positioned in the top right, in the navbar.
Everything is working correctly, but the drop down is displayed partially off screen when triggered.

I've looked through the source code for the typeahead control and it is using the PopupService and Positioning util in order to achieve this positioning for the popup.

Is there some way of configuring/specifying that when a popup is displayed off screen (outside the view port) that the calculation for the positioning takes this into consideration?

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 4.3.4
ng-bootstrap: 1.0.0-beta.1
Bootstrap: 4.0.0-beta

@pkozlowski-opensource
Copy link
Member

pkozlowski-opensource commented Aug 23, 2017

Nope, we are not taking viewport into account when calculating position as of today. The good news, though, is that we are working on a PR that is going to add viewport-awerness to the positioning service. We should have it ready in the coming days.

To enable this in typeaheads we would also need add / expose the placement input so it is not hard-coded here:

this._elementRef.nativeElement, this._windowRef.location.nativeElement, 'bottom-left',

@SauceCode84 would you be up to sending a PR that adds the placement @Input to the typeahead? You could use 3e22a63 as inspiration. This would help us to have the feature you are after.

@SauceCode84
Copy link
Author

SauceCode84 commented Aug 23, 2017

I'd be happy to make that change and send a pull request.

Another question... How do I go about linking the ng-bootstrap repo to my project for future development?
I've tried npm link ../ng-boostrap, but to this means I would have to change all the references in my project.

@collindutter
Copy link

I see that the placement input has been exposed, and I'm able to position the typeahead using it, but it still doesn't appear to be viewport conscious for me. Am I missing something?

rmeans pushed a commit to fcsa-teamhammer/ng-bootstrap that referenced this issue Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants