Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/components/modules/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,19 @@ export default class UI extends Module<UINodes> {
/**
* If there is no selected range, close inline toolbar
*
* But do not close it if the user is interacting with a form control
* inside the Inline Toolbar popover (e.g. clicking on an <input> or <select>).
* In such case the selection is lost, but the Inline Toolbar should stay open.
*
* @todo Make this method more straightforward
*/
if (!Selection.range) {
this.Editor.InlineToolbar.close();
const activeElement = document.activeElement;
const isActiveElementInsideInlineToolbar = activeElement !== null && this.Editor.InlineToolbar.containsNode(activeElement);

if (!isActiveElementInsideInlineToolbar) {
this.Editor.InlineToolbar.close();
}
}

return;
Expand Down Expand Up @@ -932,3 +941,4 @@ export default class UI extends Module<UINodes> {
this.readOnlyMutableListeners.on(this.nodes.wrapper, 'focusout', handleInputOrFocusChange);
}
}