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

feat(dropdown): Add dropup behavior #3703

Closed
wants to merge 73 commits into from
Closed

Conversation

gorork
Copy link
Contributor

@gorork gorork commented May 23, 2015

Makes dropdown menu go upwards if it's at the bottom of the browser window and is being partially hidden.
Moves DOM logic to directive.

Closes #1317

Makes dropdown menu go upwards if it's at the bottom of the browser window.
Moves DOM logic to directive.

CLoses angular-ui#1317
@rvanbaalen
Copy link
Contributor

This is some nice work! I was thinking wouldn't is be best to add this sort of functionality to the $position service in order to allow tooltip and popover to have the same sort of logic?

Also, we need some tests for this beauty.

@gorork
Copy link
Contributor Author

gorork commented May 23, 2015

@rvanbaalen Thanks! Moving these calculations to $position service is a great idea. I'd like work on it after creating tests for this one. Would it work?

@gorork
Copy link
Contributor Author

gorork commented May 30, 2015

@rvanbaalen I've added tests for this pr.
If everything looks good here, I'm moving to a new branch for $position service.

dropdownMenuHeight = $position.position(dropdownMenu).height,
dropdownMenuBottom = dropdownOffset + dropdownHeight + dropdownMenuHeight;

if ( appendToBody !== undefined ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this isn't just if (appendToBody)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wesleycho Here if you check for falseness dropdown.attr('dropdown-append-to-body') evaluates to false even if dropdown-append-to-body attribute is applied to dropdown element.
So we need to specifically check for its undefined state.

@wesleycho wesleycho modified the milestones: 0.13.1 (Performance), Backlog Jun 4, 2015
var dropdown, appendToBody,
dropdownMenu = element;

scope.$watch(dropdownCtrl.isOpen, function( isOpen ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why this $watch isn't in the controller?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wesleycho I believe Link function is more appropriate, because most of the logic here is DOM-related (and Link function and Controller share the same scope in this case).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I would favor this being in the controller - this adds an additional $watch for what seems to be unnecessary reasons.

wesleycho and others added 13 commits September 9, 2015 21:10
- Due to switch to raw `addEventListener`, changed to add and remove
  listeners to event triggers by iteration

Fixes angular-ui#4371
Closes angular-ui#4384
- Change to pass object due to how `&` binding works

Fixes angular-ui#4386
Closes angular-ui#4387
- Added ability to add a class to the most recently opened modal window.
  Note that even if different classes are specified, the class will
only be present if the modal is the most recently opened modal, i.e. if
modal1 was opened with a top class of `foo`, and modal2 is opened
afterwards with a top class of `bar`, modal2 will have the class `bar`
for the modal window, and modal1 will not have the class `foo`.

Closes angular-ui#2524
- Hide tooltip when `esc` is hit for accessibility

Closes angular-ui#4367
Resolves angular-ui#4248
@wesleycho
Copy link
Contributor

Can you rebase this off of current master?

wesleycho and others added 6 commits October 3, 2015 11:12
- Expose `AccordionController` with deprecation message

Closes angular-ui#4524
- Re-expose `AlertController` with deprecation message

Closes angular-ui#4525
Makes dropdown menu go upwards if it's at the bottom of the browser window.
Moves DOM logic to directive.

CLoses angular-ui#1317
@wesleycho
Copy link
Contributor

Is there any possible way you can abstract this logic for determining whether to do the up or down to the $position service? It could be of immense use to other components for supporting an auto setting. It would have to be built in a way that could also entertain the possibility of right vs. left positional rendering as well.

@gorork
Copy link
Contributor Author

gorork commented Oct 4, 2015

@wesleycho Rebased it.
As for $position, I would definitely abstract this. I'd prefer to work on this in a separate branch/pr though.

@wesleycho
Copy link
Contributor

Looks like there are conflicts still - also looks like the history got busted - maybe try filing a new PR with the history fixed? You might have rebased when there was a merge commit present - the merge commit causes problems with history, which is why we always rebase.

@gorork
Copy link
Contributor Author

gorork commented Oct 4, 2015

@wesleycho Here is a new PR: #4534
Should I close this one?

@wesleycho
Copy link
Contributor

Closing as this is superceded by the referenced PR

@wesleycho wesleycho closed this Oct 15, 2015
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.

Make dropdown menu go upwards if it is at the bottom of the browser window