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

Fix dropdown margins #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Folkman
Copy link

@Folkman Folkman commented Jul 24, 2018

Description (required)

This solves the issue resulting from the virtualScroll option of bootstrap-select that adds top and bottom margins to the inner dropdown in order to simulate a long list without loading all the option elements in the DOM. When performing another search that is shorter, the margins need to be reset.

Screenshots (optional)

Before
screen shot 2018-07-24 at 3 36 00 pm

After
screen shot 2018-07-24 at 3 36 50 pm

Closes Issue (optional)

Closes #156

Merge checklist (required, for maintainers only)

This pull request adheres to the following requirements:

  • [] JavaScript follows 4 space indentation conventions.
  • [] JavaScript was written using ES2015 (ES6) features.
  • [] Features and bug fixes are covered by test cases.
  • [] All commits follow the AngularJS Git Commit Message Conventions.


// Collapse dropdown after large search results
this.plugin.$element.nextAll('.dropdown-menu')
.find('ul.dropdown-menu.inner')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This traverses the DOM each time. DOM elements should get their own property on the object that can be targeted for performance reasons.

// Collapse dropdown after large search results
this.plugin.$element.nextAll('.dropdown-menu')
.find('ul.dropdown-menu.inner')
.css({ margin: 0 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of using jQuery/JavaScript to style elements. This almost feels like fixing a symptom rather than the actual cause.

@markhalliwell
Copy link
Contributor

Please base PRs agains the dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inner dropdown menu doesn't collapse for short results after long results
3 participants