-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(aria/combobox): allow custom popup triggering logic (#32493) #33198
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
Open
tjshiu
wants to merge
1
commit into
angular:main
Choose a base branch
from
tjshiu:customPopupTriggeringLogic
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
...imple-combobox/simple-combobox-custom-trigger/simple-combobox-custom-trigger-example.html
This file contains hidden or 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,36 @@ | ||
| <div class="example-combobox-container"> | ||
| <div #origin class="example-combobox-input-container"> | ||
| <span class="material-symbols-outlined example-icon example-search-icon">search</span> | ||
| <input ngCombobox #combobox="ngCombobox" [trigger]="btnEl" class="example-combobox-input" placeholder="Search states..." | ||
| [(value)]="searchString" [(expanded)]="popupExpanded" [openOnInput]="false" /> | ||
| <button #btnEl (click)="togglePopup()" aria-label="Toggle popup" class="example-combobox-button example-button"> | ||
| <span class="material-symbols-outlined">{{ popupExpanded() ? 'arrow_drop_up' : 'arrow_drop_down' }}</span> | ||
| </button> | ||
| </div> | ||
|
|
||
| <div aria-live="polite" class="cdk-visually-hidden"> | ||
| {{options().length === 0 ? 'No results found for ' + searchString() : ''}} | ||
| </div> | ||
|
|
||
| <ng-template [cdkConnectedOverlay]="{origin, usePopover: 'inline', matchWidth: true}" | ||
| [cdkConnectedOverlayOpen]="popupExpanded()" [cdkConnectedOverlayDisableClose]="true"> | ||
| <ng-template ngComboboxPopup [combobox]="combobox"> | ||
| <div class="example-popup"> | ||
| @if (options().length === 0) { | ||
| <div class="example-no-results">No results found</div> | ||
| } | ||
| <div #listbox="ngListbox" ngListbox ngComboboxWidget class="example-listbox" focusMode="activedescendant" | ||
| [tabindex]="-1" selectionMode="explicit" [(value)]="selectedOption" (click)="onCommit()" | ||
| (keydown.enter)="onCommit()" [activeDescendant]="listbox.activeDescendant()" | ||
| [class.example-empty]="options().length === 0"> | ||
| @for (option of options(); track option) { | ||
| <div class="example-option example-selectable example-stateful" ngOption [value]="option" [label]="option"> | ||
| <span>{{option}}</span> | ||
| <span aria-hidden="true" class="material-symbols-outlined example-icon example-selected-icon">check</span> | ||
| </div> | ||
| } | ||
| </div> | ||
| </div> | ||
| </ng-template> | ||
| </ng-template> | ||
| </div> |
Oops, something went wrong.
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 feel these two APIs are for niche use cases that need more discussion. Let's discuss in the sync.
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.
yeah - I can see that: It's related to this: #32493
I added an example for dev-app preview, which adds a trigger button.