-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Combobox listbox compatible #20291
Conversation
12497e5
to
0808f5e
Compare
…impler for this PR.
…tomatically compatible with being inside a combobox.
…nel inside listbox.
…s messed up the tests.
…tedValues function.
…pup which needs to be fixed, and test is temporarily removed.
1f732d5
to
48d05c3
Compare
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'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
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>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_updatePanel(option: CdkOption<T>) { | |
_updatePanelForSelection(option: CdkOption<T>) { |
if (document.activeElement === this._activeOption.getElementRef().nativeElement) { | ||
this._elementRef.nativeElement.focus(); | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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.