Skip to content

Commit e3b6810

Browse files
authored
fix: Make IDs of comment bar buttons consistent (#10280)
1 parent 55f62a0 commit e3b6810

4 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎packages/blockly/core/comments/collapse_comment_bar_button.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,24 @@ export class CollapseCommentBarButton extends CommentBarButton {
4141
* @param container An SVG group that this button should be a child of.
4242
*/
4343
constructor(
44-
protected readonly id: string,
45-
protected readonly workspace: WorkspaceSvg,
46-
protected readonly container: SVGGElement,
47-
protected readonly commentView: CommentView,
44+
id: string,
45+
workspace: WorkspaceSvg,
46+
container: SVGGElement,
47+
commentView: CommentView,
4848
) {
49-
super(id, workspace, container, commentView);
49+
super(
50+
`${id}${COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER}`,
51+
workspace,
52+
container,
53+
commentView,
54+
);
5055

5156
this.icon = dom.createSvgElement(
5257
Svg.IMAGE,
5358
{
5459
'class': 'blocklyFoldoutIcon',
5560
'href': `${this.workspace.options.pathToMedia}foldout-icon.svg`,
56-
'id': `${this.id}${COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER}`,
61+
'id': this.id,
5762
},
5863
this.container,
5964
);

‎packages/blockly/core/comments/comment_bar_button.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export abstract class CommentBarButton implements IFocusableNode {
2828
* @param container An SVG group that this button should be a child of.
2929
*/
3030
constructor(
31-
protected readonly id: string,
31+
readonly id: string,
3232
protected readonly workspace: WorkspaceSvg,
3333
protected readonly container: SVGGElement,
3434
protected readonly commentView: CommentView,

‎packages/blockly/core/comments/delete_comment_bar_button.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,24 @@ export class DeleteCommentBarButton extends CommentBarButton {
4141
* @param container An SVG group that this button should be a child of.
4242
*/
4343
constructor(
44-
protected readonly id: string,
45-
protected readonly workspace: WorkspaceSvg,
46-
protected readonly container: SVGGElement,
47-
protected readonly commentView: CommentView,
44+
id: string,
45+
workspace: WorkspaceSvg,
46+
container: SVGGElement,
47+
commentView: CommentView,
4848
) {
49-
super(id, workspace, container, commentView);
49+
super(
50+
`${id}${COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER}`,
51+
workspace,
52+
container,
53+
commentView,
54+
);
5055

5156
this.icon = dom.createSvgElement(
5257
Svg.IMAGE,
5358
{
5459
'class': 'blocklyDeleteIcon',
5560
'href': `${this.workspace.options.pathToMedia}delete-icon.svg`,
56-
'id': `${this.id}${COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER}`,
61+
'id': this.id,
5762
},
5863
container,
5964
);

‎packages/blockly/core/workspace_svg.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,8 +2977,7 @@ export class WorkspaceSvg
29772977
return (
29782978
comment.view
29792979
.getCommentBarButtons()
2980-
.find((button) => button.getFocusableElement().id.includes(id)) ??
2981-
null
2980+
.find((button) => button.id.includes(id)) ?? null
29822981
);
29832982
}
29842983
}

0 commit comments

Comments
 (0)