Skip to content

Combobox listbox compatible #20291

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 27 commits into from
Aug 14, 2020

Conversation

nielsr98
Copy link
Contributor

Added logic necessary for CdkListbox to be used inside CdkComboboxPanel and be ready to communicate with its parent panel without any additional directives. Currently some changes exist that are already in another approved PR. Will rebase after that PR is merged.

@nielsr98 nielsr98 requested a review from jelbourn as a code owner August 13, 2020 03:12
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 13, 2020
@nielsr98 nielsr98 added the target: minor This PR is targeted for the next minor release label Aug 13, 2020
@nielsr98 nielsr98 force-pushed the combobox-listbox-compatible branch 2 times, most recently from 12497e5 to 0808f5e Compare August 14, 2020 17:07
…tomatically compatible with being inside a combobox.
…pup which needs to be fixed, and test is temporarily removed.
@nielsr98 nielsr98 force-pushed the combobox-listbox-compatible branch from 1f732d5 to 48d05c3 Compare August 14, 2020 17:50
Comment on lines 308 to 314
if (this._parentPanel === null || this._parentPanel === undefined) {
if (this._explicitPanel !== null && this._explicitPanel !== undefined) {
this._explicitPanel._registerContent(this.id, 'listbox');
}
} else {
this._parentPanel._registerContent(this.id, 'listbox');
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (this._parentPanel === null || this._parentPanel === undefined) {
if (this._explicitPanel !== null && this._explicitPanel !== undefined) {
this._explicitPanel._registerContent(this.id, 'listbox');
}
} else {
this._parentPanel._registerContent(this.id, 'listbox');
}
const panel = this._parentPanel || this._explicitPanel;
panel?._registerContent(this.id, 'listbox');

Similar for _updatePanel below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay that's simpler.

@@ -358,6 +388,20 @@ export class CdkListbox<T> implements AfterContentInit, OnDestroy, OnInit, Contr
this._selectionModel.deselect(option);
}

_updatePanel(option: CdkOption<T>) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_updatePanel(option: CdkOption<T>) {
_updatePanelForSelection(option: CdkOption<T>) {

Comment on lines 431 to 433
if (document.activeElement === this._activeOption.getElementRef().nativeElement) {
this._elementRef.nativeElement.focus();
}
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- why would the focus move back to the listbox?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was something I added last night that might not make sense. But basically if the listbox is using aria-active descendant it was my understanding that we wouldn't want to focus the options on click. The way I had it implemented the options wouldn't focus when reached via keyboard but on click they would. This moved the focus back to the listbox.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a bit of a strange way to do it but that's what I could figure out last night. If there's a better way to do it then I can remove this for now and just note it as a current bug to fix this weekend.

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 labels Aug 14, 2020
@andrewseguin andrewseguin added the merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed label Aug 14, 2020
@andrewseguin andrewseguin merged commit 23d3c21 into angular:master Aug 14, 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 14, 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 merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed 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