Skip to content

Fix dropdown margins#159

Open
Folkman wants to merge 1 commit into
truckingsim:masterfrom
Folkman:fix_dropdown_margins
Open

Fix dropdown margins#159
Folkman wants to merge 1 commit into
truckingsim:masterfrom
Folkman:fix_dropdown_margins

Conversation

@Folkman
Copy link
Copy Markdown

@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.

@Folkman Folkman force-pushed the fix_dropdown_margins branch from 8738ee7 to 72fd27f Compare July 26, 2018 14:38

// Collapse dropdown after large search results
this.plugin.$element.nextAll('.dropdown-menu')
.find('ul.dropdown-menu.inner')
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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