Highlighted connection is opened, as if I had double clicked on it
Folder should expand / collapse without opening connection
Check if the click was on folder or connection

Can't reproduce this issue here. I am clicking like a beast on the folder symbol, on the open/close symbol left besides it, and on the name of the folder. But HeidiSQL still just expands or collapses the folder. I will double-check this at work, on another pc.
Hi, I made a little gif that will hopefully explain:

Yep, I could reproduce using your last method now.
Yes, I overread one has to select a connection first, not a folder. I can also reproduce that here now.
Commit b333de2913b5032ebb95f38b2df32e1de9e35a41 updates the VirtualTrees to their latest v7.3. But I'm afraid that doesn't fix this issue.
Found a fix for it, and just pushed it. Double click on the expand/collapse icons should no longer open a session.