Skip to content

Commit cb08247

Browse files
authored
fix: Fix bug that caused the focus manager to attempt to focus unfocusable elements. (#9117)
1 parent d1b17d1 commit cb08247

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

core/layer_manager.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ export class LayerManager {
104104
moveToDragLayer(elem: IRenderedElement & IFocusableNode) {
105105
this.dragLayer?.appendChild(elem.getSvgRoot());
106106

107-
// Since moving the element to the drag layer will cause it to lose focus,
108-
// ensure it regains focus (to ensure proper highlights & sent events).
109-
getFocusManager().focusNode(elem);
107+
if (elem.canBeFocused()) {
108+
// Since moving the element to the drag layer will cause it to lose focus,
109+
// ensure it regains focus (to ensure proper highlights & sent events).
110+
getFocusManager().focusNode(elem);
111+
}
110112
}
111113

112114
/**
@@ -117,9 +119,11 @@ export class LayerManager {
117119
moveOffDragLayer(elem: IRenderedElement & IFocusableNode, layerNum: number) {
118120
this.append(elem, layerNum);
119121

120-
// Since moving the element off the drag layer will cause it to lose focus,
121-
// ensure it regains focus (to ensure proper highlights & sent events).
122-
getFocusManager().focusNode(elem);
122+
if (elem.canBeFocused()) {
123+
// Since moving the element off the drag layer will cause it to lose focus,
124+
// ensure it regains focus (to ensure proper highlights & sent events).
125+
getFocusManager().focusNode(elem);
126+
}
123127
}
124128

125129
/**

0 commit comments

Comments
 (0)