Problem/Motivation
Since Drupal 10.1, custom error pages on a admin path (/admin/*) are shown with the admin theme instead of the custom theme / non-admin theme. This is for users that have some level of access to the admin pages, but not access to the specific page they are trying to get to.
I have also seen this issue in Drupal 10.2 and 10.3.
This screenshot is of the custom error page for a content editor who is trying to access /admin/reports/status, in 10.0:
This screenshot is of the custom error page for a content editor who is trying to access /admin/reports/status, in version 10.1:
This means that the content of the custom error page is not displayed as intended, because the custom error page would have been made with the expectation that it would display using the custom theme / non-admin theme.
I could not find a change recorded that I thought would cause this, so I wonder if it is an unintended change.
Steps to reproduce
- Create a node that you want to set as a custom error page
- Navigate to /admin/config/system/site-information, and set the error page path to the node you created
- As a 'Content editor' (this is a default Drupal user role), or another user with access to admin pages, navigate to a page that the user does not have access to