Skip to content

Combobox listbox refactor #20339

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

Merged
merged 28 commits into from
Aug 18, 2020
Merged

Conversation

nielsr98
Copy link
Contributor

Added fixes based on feedback from Friday's test session.

@nielsr98 nielsr98 requested a review from jelbourn as a code owner August 17, 2020 06:55
@nielsr98 nielsr98 added the target: minor This PR is targeted for the next minor release label Aug 17, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 17, 2020
Comment on lines +47 to +49
if (this.contentType && this.contentType !== contentType) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment that explains that changing the content type after opening isn't allowed?

Comment on lines +44 to +51
@Input()
get firstFocus(): HTMLElement {
return this._firstFocusElement;
}
set firstFocus(id: HTMLElement) {
this._firstFocusElement = id;
}
private _firstFocusElement: HTMLElement;
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite follow this; if this directive is for dialog combobox content, I think the focus element would always be this.elementRef.nativeElement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought process was that if the popup is a dialog, then this.elementRef.nativeElement.focus() will just focus the entire popup. With this input, the user could choose to immediately focus some interior element like an input or listbox inside the dialog.

Copy link
Member

Choose a reason for hiding this comment

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

We should be able to take care of that with the focus trap from cdk/a11y without having to add direct support for it to the pop-up here (in fact CdkDialog would take care of that automatically).

Comment on lines +78 to +81
@Input()
get autoSetText(): boolean { return this._autoSetText; }
set autoSetText(value: boolean) { this._autoSetText = coerceBooleanProperty(value); }
private _autoSetText: boolean = true;
Copy link
Member

Choose a reason for hiding this comment

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

Add a JsDoc description that explains what this property does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah will do.

const contentArray = coerceArray(content);
this._elementRef.nativeElement.textContent = contentArray.join(' ');
}

private _isTextTrigger() {
const tagName = this._elementRef.nativeElement.tagName.toLowerCase();
Copy link
Member

Choose a reason for hiding this comment

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

I would add a TODO to also test for contenteditable (I think supporting that will take some more thought before doing it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

Comment on lines +393 to +396
const isArrow = (keyCode === UP_ARROW
|| keyCode === DOWN_ARROW
|| keyCode === LEFT_ARROW
|| keyCode === RIGHT_ARROW);
Copy link
Member

Choose a reason for hiding this comment

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

Should this always be all four, or should it depend on the orientation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The isArrow variable is true if any arrow key is pressed. In the following if statement, a selection change will only occur if there is a new active option which the listKeyManager keeps track of. The listKeyManager knows the orientation, so if RIGHT is pressed while I vertical mode, the active item won't switch and even though isArrow is true no action is taken.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added action: merge The PR is ready for merge by the caretaker merge safe and removed action: merge The PR is ready for merge by the caretaker labels Aug 17, 2020
@jelbourn
Copy link
Member

You can add merge-ready when ready

@nielsr98 nielsr98 added the action: merge The PR is ready for merge by the caretaker label Aug 17, 2020
@wagnermaciel wagnermaciel merged commit d7754e7 into angular:master Aug 18, 2020
@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 18, 2020
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 target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants