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.

Feature Request: Allow ng-dropdown panel option to grow larger than parent

See original GitHub issue

Expected behaviour

Allow the dropdown panel width for the options to grow larger than the parent for long items

Actual behaviour

Dropdown panel width limited to the size of the parent

More Info

ng-select version:1.0.3

I can allow this by changing the ng-dropdown-panel.component line 363:

        //from: dropdownPanel.style.width = selectRect.width + 'px';
		dropdownPanel.style.width = 'auto';
        dropdownPanel.style.minWidth = selectRect.width + 'px';

perhaps it makes sense to make this an option.

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

18reactions
SergeyChermancommented, Mar 3, 2019

This works fine when virtual scroll is false, but when setting [virtualScroll]="true" then width: auto doesn’t work.

2reactions
carpeVideocommented, Apr 19, 2018

Yes - CSS only would be the ideal solution, however, you can’t just use CSS because the minimum size is calculated in the code. So while I can over-ride and set the width to auto, CSS can not know the minimum size to set.

So what happens is if an ng-select has text that is smaller than the parent the panel becomes smaller than the parent which looks terrible.

So I realized there is an easy way to make it allow in CSS with 1 minor code change:

        //from: dropdownPanel.style.width = selectRect.width + 'px';
        dropdownPanel.style.minWidth = selectRect.width + 'px';

Then the behavior is as always to most users, but if you want the panel to grow larger than the parent in css set the panel width to ‘auto’. If you could make that small change that would be very helpful.

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng-dropdown-panel in ng-select - how to keep its custom ...
But when I am rendering <ng-select> with appendTo="body" then the ng-dropdown-panel is no more taking the custom styles and the reason is as ......
Read more >
ngSelect Customizations: Draggable Panel
Today I'm writing about how I made the ng-select dropdown resize by dragging the dropdown box wider. If you want to follow along...
Read more >
TikTok app safety - What parents need to know
What do parents say about the app? What should parents be concerned about? Does TikTok have any e-safety features?
Read more >
overflow-x - CSS: Cascading Style Sheets - MDN Web Docs
The overflow-x CSS property sets what shows when content overflows a block-level element's left and right edges. This may be nothing, ...
Read more >
ng-multiselect-dropdown
dropdown with single/multiple selction option · bind to any custom data source · search item with custom placeholder text · limit selection ·...
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