I am running Kubuntu 20.04 and Flatpak 1.6.5. Dolphin is my default File Manager
when I open a directory from a Flatpak app such as DropBox or Cryptomator, it opens it in Visual Studio Code instead of Dolphin. This doesn't happen if I open a directory from a non Flatpak app. Also xdg-open ~
as expected opens Dolphin. So it seems to be a Flatpak issue.
Visual Studio Code is installed with apt, the official way to install it.
This other question seems similar: Flatpak applications use nautilus instead of Dolphin
I notice the same issue opening a directory from Chromium Browser installed as a Snap.
Update
This is the issue I have opened on Github on the repo flatpak/xdg-desktop-portal
Update
I have upgraded my system to Kubuntu 22.04, the issue seems to be solved for Flatpak apps but still affects Snap apps.