Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
width: 13rem;
font-size: 1rem;
border-radius: 0.25rem;
padding: 0.75rem 0.5rem 0.75rem 2.5rem;
padding: 0.75rem 2.5rem 0.75rem 2.5rem;
color: var(--primary-contrast);
outline: none;
border: 1px solid var(--quinary-contrast);
Expand Down Expand Up @@ -111,3 +111,35 @@
.check-icon {
font-size: 0.9rem;
}

.clear-button {
position: absolute;
right: 0.75rem;
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
border: none;
background-color: transparent;
border-radius: 0.25rem;
cursor: pointer;
color: var(--quaternary-contrast);
padding: 0;
margin: 0;
outline: none;
transition: background-color 0.15s ease;
}

.clear-button:hover {
background-color: color-mix(in srgb, var(--primary-contrast) 5%, transparent);
}

.clear-button:focus-visible {
outline: 2px solid var(--hot-pink);
outline-offset: -2px;
}

.clear-icon {
font-size: 1.25rem;
}
11 changes: 11 additions & 0 deletions adev/src/content/examples/aria/autocomplete/src/basic/app/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
(click)="popupExpanded.set(true)"
(focusout)="onBlur()"
/>
<button
type="button"
class="clear-button"
aria-label="Clear"
(mousedown)="$event.preventDefault()"
(click)="clear()"
>
<span class="clear-icon material-symbols-outlined" translate="no" aria-hidden="true"
>close</span
>
</button>
</div>

<div aria-live="polite" class="cdk-visually-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import {FormsModule} from '@angular/forms';
imports: [Combobox, ComboboxPopup, ComboboxWidget, Listbox, Option, OverlayModule, FormsModule],
})
export class App {
clear() {
this.query.set('');
this.selectedOption.set([]);
this.popupExpanded.set(false);
}

readonly listbox = viewChild(Listbox);
readonly combobox = viewChild(Combobox);

Expand All @@ -37,6 +43,7 @@ export class App {
onCommit() {
this.commitSelection();
this.popupExpanded.set(false);
this.combobox()?.element.focus();
}

private commitSelection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
width: 13rem;
font-size: 1rem;
border-radius: 3rem;
padding: 0.75rem 0.5rem 0.75rem 2.5rem;
padding: 0.75rem 2.5rem 0.75rem 2.5rem;
color: var(--primary-contrast);
outline: none;
border: 1px solid var(--quinary-contrast);
Expand Down Expand Up @@ -112,3 +112,40 @@
.check-icon {
font-size: 0.9rem;
}

.clear-button {
position: absolute;
right: 0.75rem;
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
border: none;
background-color: transparent;
border-radius: 50%;
cursor: pointer;
color: var(--quaternary-contrast);
padding: 0;
margin: 0;
outline: none;
transition:
background-color 0.15s ease,
color 0.15s ease;
}

.clear-button:hover {
color: var(--primary);
background-color: color-mix(in srgb, var(--primary) 10%, transparent);
}

.clear-button:focus-visible {
color: var(--primary);
background-color: color-mix(in srgb, var(--primary) 15%, transparent);
outline: 2px solid var(--primary);
outline-offset: -2px;
}

.clear-icon {
font-size: 1.25rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
(click)="popupExpanded.set(true)"
(focusout)="onBlur()"
/>
<button
type="button"
class="clear-button"
aria-label="Clear"
(mousedown)="$event.preventDefault()"
(click)="clear()"
>
<span class="clear-icon material-symbols-outlined" translate="no" aria-hidden="true"
>close</span
>
</button>
</div>

<div aria-live="polite" class="cdk-visually-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import {FormsModule} from '@angular/forms';
imports: [Combobox, ComboboxPopup, ComboboxWidget, Listbox, Option, OverlayModule, FormsModule],
})
export class App {
clear() {
this.query.set('');
this.selectedOption.set([]);
this.popupExpanded.set(false);
}

readonly listbox = viewChild(Listbox);
readonly combobox = viewChild(Combobox);

Expand All @@ -37,6 +43,7 @@ export class App {
onCommit() {
this.commitSelection();
this.popupExpanded.set(false);
this.combobox()?.element.focus();
}

private commitSelection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
display: flex;
position: relative;
align-items: center;
box-shadow: var(--retro-flat-shadow);
background-color: var(--retro-button-color);
}

.retro-autocomplete:focus-within {
box-shadow: var(--retro-pressed-shadow);
}

.material-symbols-outlined {
Expand All @@ -55,20 +61,14 @@
border-radius: 0;
font-family: 'Press Start 2P';
word-spacing: -5px;
padding: 0.75rem 0.5rem 0.75rem 2.5rem;
padding: 0.75rem 2.5rem 0.75rem 2.5rem;
color: #000;
border: none;
box-shadow: var(--retro-flat-shadow);
background-color: var(--retro-button-color);
background-color: transparent;
box-shadow: none;
outline: none;
}

.autocomplete-input:focus-visible {
outline: none;
transform: translate(1px, 1px);
box-shadow: var(--retro-pressed-shadow);
}

.autocomplete-input::placeholder {
color: #000;
opacity: 0.7;
Expand Down Expand Up @@ -133,3 +133,48 @@
.check-icon {
font-size: 0.9rem;
}

.clear-button {
position: absolute;
right: 0.75rem;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
background: var(--win95-gray);
color: var(--win95-shadow);
border-style: solid;
border-width: 1px;
border-color: var(--win95-light) var(--win95-dark-gray) var(--win95-dark-gray) var(--win95-light);
box-shadow: 1px 1px 0 var(--win95-shadow);
cursor: pointer;
padding: 0;
margin: 0;
outline: none;
font-family: 'Press Start 2P';
font-size: 0.6rem;
user-select: none;
}

.clear-button:hover {
background: #e0e0e0;
outline: 1px dashed var(--win95-dark-gray);
outline-offset: 1px;
}

.clear-button:active {
border-color: var(--win95-dark-gray) var(--win95-light) var(--win95-light) var(--win95-dark-gray);
box-shadow: 1px 1px 0 var(--win95-shadow) inset;
}

.clear-button:focus-visible {
outline: 2px dashed var(--hot-pink);
outline-offset: 4px;
}

.clear-icon {
display: flex;
align-items: center;
justify-content: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
(click)="popupExpanded.set(true)"
(focusout)="onBlur()"
/>
<button
type="button"
class="clear-button"
aria-label="Clear"
(mousedown)="$event.preventDefault()"
(click)="clear()"
>
<span class="clear-icon" aria-hidden="true">X</span>
</button>
</div>

<div aria-live="polite" class="cdk-visually-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import {FormsModule} from '@angular/forms';
imports: [Combobox, ComboboxPopup, ComboboxWidget, Listbox, Option, OverlayModule, FormsModule],
})
export class App {
clear() {
this.query.set('');
this.selectedOption.set([]);
this.popupExpanded.set(false);
}

readonly listbox = viewChild(Listbox);
readonly combobox = viewChild(Combobox);

Expand All @@ -37,6 +43,7 @@ export class App {
onCommit() {
this.commitSelection();
this.popupExpanded.set(false);
this.combobox()?.element.focus();
}

private commitSelection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
width: 13rem;
font-size: 1rem;
border-radius: 0.25rem;
padding: 0.75rem 0.5rem 0.75rem 2.5rem;
padding: 0.75rem 2.5rem 0.75rem 2.5rem;
color: var(--primary-contrast);
outline: none;
border: 1px solid var(--quinary-contrast);
Expand Down Expand Up @@ -111,3 +111,35 @@
.check-icon {
font-size: 0.9rem;
}

.clear-button {
position: absolute;
right: 0.75rem;
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
border: none;
background-color: transparent;
border-radius: 0.25rem;
cursor: pointer;
color: var(--quaternary-contrast);
padding: 0;
margin: 0;
outline: none;
transition: background-color 0.15s ease;
}

.clear-button:hover {
background-color: color-mix(in srgb, var(--primary-contrast) 5%, transparent);
}

.clear-button:focus-visible {
outline: 2px solid var(--hot-pink);
outline-offset: -2px;
}

.clear-icon {
font-size: 1.25rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
(keydown.arrowup)="navigated.set(true)"
[inlineSuggestion]="query() || navigated() ? selectedOption()[0] : undefined"
/>
<button
type="button"
class="clear-button"
aria-label="Clear"
(mousedown)="$event.preventDefault()"
(click)="clear()"
>
<span class="clear-icon material-symbols-outlined" translate="no" aria-hidden="true"
>close</span
>
</button>
</div>

<div aria-live="polite" class="cdk-visually-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import {FormsModule} from '@angular/forms';
imports: [Combobox, ComboboxPopup, ComboboxWidget, Listbox, Option, OverlayModule, FormsModule],
})
export class App {
clear() {
this.query.set('');
this.selectedOption.set([]);
this.popupExpanded.set(false);
this.navigated.set(false);
}

readonly listbox = viewChild(Listbox);
readonly combobox = viewChild(Combobox);

Expand Down Expand Up @@ -45,6 +52,7 @@ export class App {
this.query.set('');
}
this.popupExpanded.set(false);
this.combobox()?.element.focus();
}
}

Expand Down
Loading
Loading