Steps to reproduce
- Install a plugin that has documentation links in its settings. (I’ve repro’d with Agent Client and Templater)
- Open one or more popout windows
- In any window, open the plugin’s settings pane
- Click on a documentation link
Did you follow the troubleshooting guide? [Y/N]
Y
(Note: the issue is not specific to any one plugin: AFAICT any plugin that includes an <a href=""> link displays this behavior, and it even happens if you add a link to a core plugin page with the inspector, or remove target="blank" from an existing link (e.g. in reading mode). The issue appears to be that any links without target="blank" trigger an onBeforeUnload event in the window where the settings dialog is opened. In practice, this is impossible to repro in Obsidian without either a plugin or the inspector, but it’s not a documented requirement for plugin devs, and it makes clicking any link in a plugin view or settings tab potentially hazardous, especially given the way the main window’s quit handler works.)
Expected result
Link opens in browser (or browser view if enabled)
Actual result
All popout windows close (if clicked in main window), or active popout closes (if clicked in a popout) before the link opens.
Environment
SYSTEM INFO:
Obsidian version: v1.10.6
Installer version: v1.10.6
Operating system: Windows 10 Pro 10.0.19045
Login status: logged in
Language: en
Catalyst license: supporter
Insider build toggle: off
Live preview: on
Base theme: light
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 1
1: Templater v2.18.1
RECOMMENDATIONS:
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
Additional information
If the link is clicked in the main window, the bug will only happen once, as the onBeforeUnload handler disables itself thereafter. But you can repro in individual popouts as much as you like, since you’ll be doing it in a different popout each time.
It may be that plugin developers need to be informed of the need to add target=“blank” to work around this issue, but it would probably be good to have a mitigation in the app, e.g. a fallback event handler that adds the needed target="blank" when clicking on a link without one. It isn’t currently documented as a requirement, and AFAICT it’s just as problematic for links in any plugin-supplied HTML, not just their settings.
And even if the plugin devs are ultimately responsible, the appearance of Obsidian being unstable isn’t great. It took me quite a while to trace my “mysteriously closing windows” problem to “that was when I clicked a link and didn’t see my windows go away because the browser opened on top of where they were” - so most users are unlikely to realize their disappearing windows are due to a third-party plugin.