Skip to content

Commit 4b9147b

Browse files
Copilotalexr00
andcommitted
Fix keyboard accessibility - use event.type instead of 'in' operator
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 30c9414 commit 4b9147b

File tree

1 file changed

+9
-2
lines changed
  • webviews/createPullRequestViewNew

1 file changed

+9
-2
lines changed

webviews/createPullRequestViewNew/app.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,15 @@ export function main() {
173173
}
174174

175175
function openDescriptionSettings(event: React.MouseEvent | React.KeyboardEvent): void {
176-
event.preventDefault();
177-
ctx.postMessage({ command: 'pr.openDescriptionSettings' });
176+
if (event.type === 'keydown') {
177+
const keyEvent = event as React.KeyboardEvent;
178+
if (keyEvent.key === 'Enter' || keyEvent.key === ' ') {
179+
event.preventDefault();
180+
ctx.postMessage({ command: 'pr.openDescriptionSettings' });
181+
}
182+
} else {
183+
ctx.postMessage({ command: 'pr.openDescriptionSettings' });
184+
}
178185
}
179186

180187
async function generateTitle(useCopilot?: boolean) {

0 commit comments

Comments
 (0)