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(autocomplete): up arrow should set last item active #2776

Merged
merged 1 commit into from
Jan 27, 2017

Conversation

kara
Copy link
Contributor

@kara kara commented Jan 24, 2017

@kara kara requested review from jelbourn and andrewseguin January 24, 2017 02:41
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 24, 2017
export const AUTOCOMPLETE_OPTION_HEIGHT = 48;

/** The total height of the autocomplete panel. */
export const MD_AUTOCOMPLETE_PANEL_HEIGHT = 256;
Copy link
Member

Choose a reason for hiding this comment

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

One constant has MD_ and the other doesn't; they should be consistent (I would omit the MD_ since they're really just meant for internal consumption.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch; not sure why I did that.

@@ -37,8 +47,12 @@ export class MdAutocompleteTrigger implements AfterContentInit, OnDestroy {
private _portal: TemplatePortal;
private _panelOpen: boolean = false;

/** The subscription to positioning changes in the autocomplete panel. */
private _panelPositionSub: Subscription;
Copy link
Member

Choose a reason for hiding this comment

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

_panelPositionSubscription?
(generally avoiding abbreviations)

@@ -553,5 +676,15 @@ class FakeKeyboardEvent {
preventDefault() {}
}

class FakeViewportRuler {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't there a common FakeviewportRuler now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh hey. Didn't know about that, but that's way better. Will replace.

@kara kara force-pushed the autocomplete-wrap branch 2 times, most recently from 7ed5f6e to a5444f8 Compare January 25, 2017 01:44
@kara kara force-pushed the autocomplete-wrap branch from a5444f8 to 7d8e5e7 Compare January 25, 2017 01:54
}

/** Sets the active item to a previous enabled item in the list. */
setPreviousItemActive(): void {
this._setActiveItemByDelta(-1);
this._activeItemIndex === null && this._wrap ? this.setLastItemActive()
: this._setActiveItemByDelta(-1);
Copy link
Member

Choose a reason for hiding this comment

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

Need to handle the case when activeItemIndex is null and wrap is false

Copy link
Member

Choose a reason for hiding this comment

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

(with a unit test)

@kara kara force-pushed the autocomplete-wrap branch from 7d8e5e7 to 3b4836e Compare January 27, 2017 22:12
@jelbourn
Copy link
Member

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Jan 27, 2017
@kara kara merged commit d8b3653 into angular:autocomplete Jan 27, 2017
kara added a commit to kara/material2 that referenced this pull request Feb 3, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants