mirror of
https://github.com/google/blockly.git
synced 2026-06-16 16:15:14 +02:00
fix: Fix bug that caused the focus manager to attempt to focus unfocusable elements. (#9117)
This commit is contained in:
+10
-6
@@ -104,9 +104,11 @@ export class LayerManager {
|
||||
moveToDragLayer(elem: IRenderedElement & IFocusableNode) {
|
||||
this.dragLayer?.appendChild(elem.getSvgRoot());
|
||||
|
||||
// Since moving the element to the drag layer will cause it to lose focus,
|
||||
// ensure it regains focus (to ensure proper highlights & sent events).
|
||||
getFocusManager().focusNode(elem);
|
||||
if (elem.canBeFocused()) {
|
||||
// Since moving the element to the drag layer will cause it to lose focus,
|
||||
// ensure it regains focus (to ensure proper highlights & sent events).
|
||||
getFocusManager().focusNode(elem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,9 +119,11 @@ export class LayerManager {
|
||||
moveOffDragLayer(elem: IRenderedElement & IFocusableNode, layerNum: number) {
|
||||
this.append(elem, layerNum);
|
||||
|
||||
// Since moving the element off the drag layer will cause it to lose focus,
|
||||
// ensure it regains focus (to ensure proper highlights & sent events).
|
||||
getFocusManager().focusNode(elem);
|
||||
if (elem.canBeFocused()) {
|
||||
// Since moving the element off the drag layer will cause it to lose focus,
|
||||
// ensure it regains focus (to ensure proper highlights & sent events).
|
||||
getFocusManager().focusNode(elem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user