This isn’t a bug report because Obsidian is Very Good at not letting you close the file explorer. More like an interesting detail.
In the minified code for function for “reveal file in navigation” it checks if there is a file explorer tab and opens one if there isn’t.
e.prototype.revealInFolder = function(e) {
var t, n = this.app, i = n.workspace.getLeavesOfType("file-explorer");
0 === i.length ? (t = n.workspace.getLeftLeaf(!0)).setViewState({
type: "file-explorer"
}) : t = i[0],
n.workspace.revealLeaf(t),
t.view.revealInFolder(e)
}
But if there isn’t a file explorer…
TypeError: t.view.revealInFolder is not a function
If you check the value of t
in the developer console, it’s view
property looks like the view type for a new tab - not a file explorer leaf. I think this is because setViewState
(link) is asynchronous: the call to revealInFolder
is happening before the file explorer view actually gets set.
Devs is this the reason why file explorer isn’t closeable