Fixed by waiting for the full page selection tree to be loaded before clearing the selection and selecting the page. This avoids a double selection in the tree which caused the root to be returned instead of the wanted page.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.