Skip to content

Commit 3cfbb7e

Browse files
committed
feat: add keyboard support to sidebar, fullscreen, and chat context controls
Signed-off-by: adarshh <adarsh347k@gmail.com>
1 parent c7bdb15 commit 3cfbb7e

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

src/components/AIChatPanel.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,17 @@ export const AIChatPanel = () => {
400400
<span className="text-xs text-gray-600 mr-1" style={{color: textColor}}>Context:</span>
401401
{/* TemplateMark Button */}
402402
<div
403+
role="button"
404+
tabIndex={0}
405+
aria-label="Toggle TemplateMark context"
406+
aria-pressed={includeTemplateMarkContent}
403407
onClick={() => handleTemplateMarkToggle(!includeTemplateMarkContent)}
408+
onKeyDown={(e) => {
409+
if (e.key === 'Enter' || e.key === ' ') {
410+
e.preventDefault();
411+
handleTemplateMarkToggle(!includeTemplateMarkContent);
412+
}
413+
}}
404414
className={
405415
`px-1 py-0.5 text-xs rounded-full flex items-center cursor-pointer border transition-colors
406416
${includeTemplateMarkContent
@@ -435,7 +445,17 @@ export const AIChatPanel = () => {
435445
</div>
436446
{/* Concerto Button */}
437447
<div
448+
role="button"
449+
tabIndex={0}
450+
aria-label="Toggle Concerto context"
451+
aria-pressed={includeConcertoModelContent}
438452
onClick={() => handleConcertoModelToggle(!includeConcertoModelContent)}
453+
onKeyDown={(e) => {
454+
if (e.key === 'Enter' || e.key === ' ') {
455+
e.preventDefault();
456+
handleConcertoModelToggle(!includeConcertoModelContent);
457+
}
458+
}}
439459
className={
440460
`px-1 py-0.5 text-xs rounded-full flex items-center cursor-pointer border transition-colors
441461
${includeConcertoModelContent
@@ -470,7 +490,17 @@ export const AIChatPanel = () => {
470490
</div>
471491
{/* Data Button */}
472492
<div
493+
role="button"
494+
tabIndex={0}
495+
aria-label="Toggle Data context"
496+
aria-pressed={includeDataContent}
473497
onClick={() => handleDataToggle(!includeDataContent)}
498+
onKeyDown={(e) => {
499+
if (e.key === 'Enter' || e.key === ' ') {
500+
e.preventDefault();
501+
handleDataToggle(!includeDataContent);
502+
}
503+
}}
474504
className={
475505
`px-1 py-0.5 text-xs rounded-full flex items-center cursor-pointer border transition-colors
476506
${includeDataContent

src/components/FullScreenModal.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,17 @@ const FullScreenModal: React.FC = () => {
3838
<>
3939
<MdFullscreen
4040
size={24}
41+
role="button"
42+
tabIndex={0}
43+
aria-label="Open fullscreen preview"
4144
style={{ cursor: "pointer" }}
4245
onClick={() => setOpen(true)}
46+
onKeyDown={(e) => {
47+
if (e.key === 'Enter' || e.key === ' ') {
48+
e.preventDefault();
49+
setOpen(true);
50+
}
51+
}}
4352
/>
4453
<Modal
4554
title="Output"

src/components/PlaygroundSidebar.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ const PlaygroundSidebar = () => {
163163
aria-label={title}
164164
tabIndex={0}
165165
onClick={onClick}
166+
onKeyDown={(e) => {
167+
if (e.key === 'Enter' || e.key === ' ') {
168+
e.preventDefault();
169+
onClick?.();
170+
}
171+
}}
166172
className={`group playground-sidebar-nav-item ${
167173
active ? 'playground-sidebar-nav-item-active' : 'playground-sidebar-nav-item-inactive'
168174
} tour-${title.toLowerCase().replace(' ', '-')}`}
@@ -188,6 +194,12 @@ const PlaygroundSidebar = () => {
188194
aria-label={title}
189195
tabIndex={0}
190196
onClick={onClick}
197+
onKeyDown={(e) => {
198+
if (e.key === 'Enter' || e.key === ' ') {
199+
e.preventDefault();
200+
onClick();
201+
}
202+
}}
191203
className={`group playground-sidebar-nav-bottom-item tour-${title.toLowerCase().replace(' ', '-')}`}
192204
>
193205
<Icon size={18} />

0 commit comments

Comments
 (0)