The code checks for:
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow))
Which is only true after clicking on the enclosing outer pane which can only be done by clicking on the tab bar.
Once clicking anywhere within the actual main graph pane, it is no longer true so all the code in the if block is ignored (which includes the node deletion handling).

The code checks for:
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow))Which is only true after clicking on the enclosing outer pane which can only be done by clicking on the tab bar.
Once clicking anywhere within the actual main graph pane, it is no longer true so all the code in the if block is ignored (which includes the node deletion handling).