Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Add Dropdown AppendTo functionality #4488

Closed
wants to merge 2 commits into from

Conversation

jaydiablo
Copy link
Contributor

This fixes #4467.

In a UI that we're building we ran into an issue where the dropdowns had to be attached to body (because their containing element had some sort of hidden overflow, like the bootstrap responsive tables) but the body in this app is a static "window", as there's a div element that the main content is scrolled in (this is because there's a snap.js drawer used). In this situation, if the dropdowns are appended to the body element, when the user scrolls after opening a dropdown, the dropdown menu would stay in a fixed position above the scrolling content beneath.

I've added a "dropdown-append-to" attribute that accepts an "angular.element" object and will use that element as the container for the dropdown menu when it is opened. This allows us to attach the dropdown to the scrolling container which makes them scroll with the content, but don't get cutoff by hidden overflow in their immediate container.

Here's a little gif I put together of the three types of "attachment" and how they look in this sort of situation:

uprcvrq1v7

This was actually taken from the angular-ui bootstrap docs that has the changes from this PR in them.

I added tests for this, and modified the docs/demo from dropdown as well.

@wesleycho
Copy link
Contributor

Can you rebase?

@@ -220,6 +220,10 @@ describe('dropdownToggle', function() {
element = dropdown();
});

afterEach(function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This afterEach is unnecessary once this is rebased off of current master.

@wesleycho
Copy link
Contributor

I took a look - this PR looks good, just needs to have the commits squashed and then rebased on top of current master.

@wesleycho wesleycho added this to the 1.0.0 milestone Oct 30, 2015
@wesleycho
Copy link
Contributor

I made a couple of tweaks to get everything to work on master - I will have this merged shortly.

Thanks for the work!

@wesleycho wesleycho closed this in 809ecdb Oct 31, 2015
@jaydiablo
Copy link
Contributor Author

Thanks for getting that up to date and merged!

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

Successfully merging this pull request may close these issues.

Add "appendTo" functionality to dropdown
2 participants