Skip to content

Commit e3d17be

Browse files
authored
fix: Improve workspace comment keyboard navigation behavior. (#9211)
* fix: Prevent tabbing into workspace comments. * fix: Focus workspace comments when navigating to them using the keyboard.
1 parent dfd5659 commit e3d17be

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

core/comments/comment_editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class CommentEditor implements IFocusableNode {
5252
dom.HTML_NS,
5353
'textarea',
5454
) as HTMLTextAreaElement;
55+
this.textArea.setAttribute('tabindex', '-1');
5556
dom.addClass(this.textArea, 'blocklyCommentText');
5657
dom.addClass(this.textArea, 'blocklyTextarea');
5758
dom.addClass(this.textArea, 'blocklyText');

core/keyboard_nav/line_cursor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ export class LineCursor extends Marker {
401401
block.workspace.scrollBoundsIntoView(
402402
block.getBoundingRectangleWithoutChildren(),
403403
);
404+
} else if (newNode instanceof RenderedWorkspaceComment) {
405+
newNode.workspace.scrollBoundsIntoView(newNode.getBoundingRectangle());
404406
}
405407
}
406408

0 commit comments

Comments
 (0)