Skip to content

Commit 69ac1d5

Browse files
aparzikirjs
authored andcommitted
docs: show selected menu item visually in context menu example
Replace console.log with a lastAction signal and render the result in a styled <p> element with a fade-in animation.
1 parent 792edab commit 69ac1d5

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

adev/src/content/examples/aria/menu/src/menu-context/app/app.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,34 @@
7676
font-size: 0.875rem;
7777
}
7878

79+
.last-action {
80+
display: flex;
81+
align-items: center;
82+
gap: 0.5rem;
83+
margin: 0;
84+
padding: 0.75rem 1rem;
85+
border-radius: 0.5rem;
86+
border: 1px solid var(--border-color);
87+
font-size: 0.875rem;
88+
animation: fade-in 0.2s ease;
89+
}
90+
91+
.last-action .material-symbols-outlined {
92+
font-size: 1.1rem;
93+
color: var(--vivid-pink);
94+
}
95+
96+
@keyframes fade-in {
97+
from {
98+
opacity: 0;
99+
transform: translateY(-4px);
100+
}
101+
to {
102+
opacity: 1;
103+
transform: translateY(0);
104+
}
105+
}
106+
79107
[ngMenu] .separator {
80108
border-top: 1px solid var(--border-color);
81109
margin: 0.25rem 0;

adev/src/content/examples/aria/menu/src/menu-context/app/app.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Right-click inside this area to open the context menu.
44
</div>
55

6+
@if (lastAction()) {
7+
<p class="last-action">
8+
<span class="material-symbols-outlined" translate="no" aria-hidden="true">check_circle</span>
9+
Action performed: <strong>{{ lastAction() }}</strong>
10+
</p>
11+
}
12+
613
<!-- Hidden trigger positioned dynamically at cursor coordinates -->
714
<div
815
#triggerEl

adev/src/content/examples/aria/menu/src/menu-context/app/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ export class App {
2525
this.trigger().open();
2626
}
2727

28+
lastAction = signal<string | null>(null);
29+
2830
onItemSelected(value: string) {
29-
console.log(`Action selected: ${value}`);
31+
this.lastAction.set(value);
3032
}
3133

3234
onOverlayKeydown(event: KeyboardEvent) {

0 commit comments

Comments
 (0)