Skip to content

Commit 7257c30

Browse files
committed
fix: Support now-focusable bubbles and icons.
1 parent 9765d35 commit 7257c30

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/move_icon.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ export class MoveIcon implements Blockly.IIcon, Blockly.IHasBubble {
7878
return true;
7979
}
8080

81+
/**
82+
* Returns this icon's bubble.
83+
*/
84+
getBubble(): Blockly.IBubble | null {
85+
return this.moveIndicator;
86+
}
87+
8188
/**
8289
* Called when the location of this icon's block changes.
8390
*
@@ -111,4 +118,25 @@ export class MoveIcon implements Blockly.IIcon, Blockly.IHasBubble {
111118
async setBubbleVisible(visible: boolean) {}
112119

113120
initView(pointerDownListener: (e: PointerEvent) => void) {}
121+
122+
/** See IFocusableNode.getFocusableElement. */
123+
getFocusableElement(): HTMLElement | SVGElement {
124+
throw new Error('This node is not focusable.');
125+
}
126+
127+
/** See IFocusableNode.getFocusableTree. */
128+
getFocusableTree(): Blockly.IFocusableTree {
129+
throw new Error('This node is not focusable.');
130+
}
131+
132+
/** See IFocusableNode.onNodeFocus. */
133+
onNodeFocus(): void {}
134+
135+
/** See IFocusableNode.onNodeBlur. */
136+
onNodeBlur(): void {}
137+
138+
/** See IFocusableNode.canBeFocused. */
139+
canBeFocused(): boolean {
140+
return false;
141+
}
114142
}

src/move_indicator.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,25 @@ export class MoveIndicatorBubble
143143
revertDrag() {}
144144

145145
setDeleteStyle(enable: boolean) {}
146+
147+
/** See IFocusableNode.getFocusableElement. */
148+
getFocusableElement(): HTMLElement | SVGElement {
149+
throw new Error('This node is not focusable.');
150+
}
151+
152+
/** See IFocusableNode.getFocusableTree. */
153+
getFocusableTree(): Blockly.IFocusableTree {
154+
throw new Error('This node is not focusable.');
155+
}
156+
157+
/** See IFocusableNode.onNodeFocus. */
158+
onNodeFocus(): void {}
159+
160+
/** See IFocusableNode.onNodeBlur. */
161+
onNodeBlur(): void {}
162+
163+
/** See IFocusableNode.canBeFocused. */
164+
canBeFocused(): boolean {
165+
return false;
166+
}
146167
}

0 commit comments

Comments
 (0)