-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 open actions #20306
Merged
Merged
Combobox open actions #20306
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
bfdb156
build: Added required files to listbox directory.
nielsr98 f8f6399
build: added listbox option directive and renamed listbox directive f…
nielsr98 b45c6df
build: Added required files to listbox directory.
nielsr98 966225f
build: added listbox option directive and renamed listbox directive f…
nielsr98 3ae5410
build: Added required files to listbox directory.
nielsr98 46f537e
build: added listbox option directive and renamed listbox directive f…
nielsr98 aa3abdb
build: Added required files to listbox directory.
nielsr98 6ea67c5
build: added listbox option directive and renamed listbox directive f…
nielsr98 db690d6
feat(dev-app/listbox): added cdk listbox example to the dev-app.
nielsr98 dea5915
fix(listbox): removed duplicate dep in dev-app build file.
nielsr98 97eee8b
fix(listbox): deleted unused files.
nielsr98 78bfc99
refactor(combobox): changed names and made coerceOpenActionProperty s…
nielsr98 3b955df
fix(combobox): updated syntax for casting.
nielsr98 2f31abf
refactor(combobox): changed casting syntax back.
nielsr98 ab86d96
fix(combobox): fixed trailing whitespace.
nielsr98 a3e6b05
refactor(combobox): improved coerceOpenActions function to handle whi…
nielsr98 9e06f83
fix(combobox): split the coerceOpenActions on comma or space.
nielsr98 7466008
feat(combobox): added aria-expanded and aria-owns traits.
nielsr98 ac7b942
refactor(combobox): minor refactor.
nielsr98 5d7f8d5
feat(combobox): added logic to close popup on click outside of combobox.
nielsr98 e0ddc23
test(combobox): added many tests for combobox open action features.
nielsr98 7c5b802
test(combobox): added back two failing tests, focus and sending input…
nielsr98 517b42b
refactor(combobox): further tests on focus.
nielsr98 60d0079
refactor(combobox): added tabindex to allow focusing on content, and …
nielsr98 64dd2f6
fix(combobox): removed separate coerceArray import.
nielsr98 7ffc07f
fix(combobox): lint errors.
nielsr98 1b28ca7
refactor(combobox): only throw error in coercing open action in dev m…
nielsr98 d04feb9
nit(combobox): removed whitespace.
nielsr98 4671b89
fix(combobox): removed unused imports.
nielsr98 75c7825
feat(combobox): added combobox popup directive to handle registering …
nielsr98 065adf1
nit(combobox): changed double quotes to single quotes.
nielsr98 ddff626
nit(combobox): changed class names and parameter types.
nielsr98 4ce24aa
fix(combobox): changed import to relative import.
nielsr98 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {Directive, Inject, InjectionToken, Input, OnInit, Optional} from '@angular/core'; | ||
import {AriaHasPopupValue, CdkComboboxPanel} from './combobox-panel'; | ||
|
||
export const PANEL = new InjectionToken<CdkComboboxPanel>('CdkComboboxPanel'); | ||
|
||
let nextId = 0; | ||
|
||
@Directive({ | ||
selector: '[cdkComboboxPopup]', | ||
exportAs: 'cdkComboboxPopup', | ||
host: { | ||
'class': 'cdk-combobox-popup', | ||
'[attr.role]': 'role', | ||
'[id]': 'id', | ||
'tabindex': '-1' | ||
} | ||
}) | ||
export class CdkComboboxPopup<T = unknown> implements OnInit { | ||
@Input() | ||
get role(): AriaHasPopupValue { | ||
return this._role; | ||
} | ||
set role(value: AriaHasPopupValue) { | ||
this._role = value; | ||
} | ||
private _role: AriaHasPopupValue = 'dialog'; | ||
|
||
@Input() id = `cdk-combobox-popup-${nextId++}`; | ||
|
||
@Input('parentPanel') private readonly _explicitPanel: CdkComboboxPanel; | ||
|
||
constructor( | ||
@Optional() @Inject(PANEL) readonly _parentPanel?: CdkComboboxPanel<T>, | ||
) { } | ||
|
||
ngOnInit() { | ||
this.registerWithPanel(); | ||
} | ||
|
||
registerWithPanel(): void { | ||
if (this._parentPanel === null || this._parentPanel === undefined) { | ||
this._explicitPanel._registerContent(this.id, this._role); | ||
} else { | ||
this._parentPanel._registerContent(this.id, this._role); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 would add a
TODO
here to use an injected document and a separate TODO to potentially switch this to use focus trapping from cdk/a11y