question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown missplaced since 2.20.1 with appendTo

See original GitHub issue

Since 2.20.1, the dropdown is missplaced when i used: appendTo=“body”.

Capture ==> I use something like that: <ng-select [items]="articleFamillyList" bindLabel="label" bindValue="code" appendTo="body" formControlName="familly" [searchFn]="refObjectSearchFn" placeholder="--- Select a familly ---"> <ng-template ng-label-tmp let-item="item"> {{ item.code }} - {{ item.label }} </ng-template> <ng-template ng-option-tmp let-item="item" let-index="index" let-search="searchTerm"> <span [ngOptionHighlight]="search">{{ item.code }} - {{ item.label }}</span> </ng-template> </ng-select>

Exemples: Version: 2.20.1 (the dropdown not perfectly align, but less than in my app) https://stackblitz.com/edit/angular-6bsddn

Version: 2.19.0 (the dropwn down is perfectly align) https://stackblitz.com/edit/angular-8umxey

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
ahadjithomacommented, Aug 20, 2019

@stephanecot did you find any solution? I am also using appentTo="body" and body {position:relative} in my styles but it doesn’t work. In my case it seems that the position is correct when the page has scroll bar

2reactions
oliverguenthercommented, Aug 20, 2019

This is connected to the body or append to wrapper being 100% in height. When the dropdown is inserted, it’s initial height is 2px and causes the window to grow, in our case resulting in a scrollbar to be visible for a short period of time.

That shifts the entire content to the left, causing this offset.

Here’s an example that causes the dropdown to be moved to the left by the width of the scrollbar (which in stackblitz is narrow):

https://stackblitz.com/edit/angular-fzmu56?file=src/app/app.component.html

We can force the reposition using the private method _updatePosition as a workaround, which demonstrates that the position is actually correct with the current parent, but was shifted temporarily by the scrollbar (delayed in the gif by 2 seconds for dramatic effect)

demonstration-offset

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dropdown button in responsive nav menu breaks after . ...
The .appendTo() method below breaks the dropdown buttons in desktop view but they do work on the mobile screen size in the offcanvas...
Read more >
PerfectTablePlan v6.1.3 for Windows
guest proximity to change after each seating. Set the On completion drop-down list according to which multi-plan report you wish to show on...
Read more >
FICORGRG Xpress Optimization
consequential damages, including lost profits, arising out of the use of this ... After the completion of a command the mosel executable returns...
Read more >
SuperH TM RISC engine High-performance Embedded ...
To stop a build: 1. Select [Build->Stop Build] or click the stop build toolbar button ( ). The build will be stop after...
Read more >
Transact-SQL Users Guide
Create New Tables from Query Results: select into. ... Since such behavior is incompatible with many Transact-SQL applications, Transact-SQL ... are lost.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found