Skip to content

Opt-out from 404 page - Responsive color scheme #36949

@icyJoseph

Description

@icyJoseph

Describe the feature you'd like to request

Today, not every page on the web supports, nor is willing to ever support, dark mode.

However, consumers of the custom Error page are now faced with the feature introduced by this PR, #32113.

For a11y, and friendly user experiences this is great, but not all brands are inline with the idea of dark mode support. At the end of the day it is user preference, that the website might ignore.

It should be possible to opt-out from this dark mode, by passing a prop to the component, withDarkMode support perhaps, set to true by default.

Describe the solution you'd like

A prop to the Error page, to enable the dark mode. Perhaps named withDarkMode, set to true by default, to not break behaviour for other users, as it should've done initially.

Describe alternatives you've considered

The feature injects a CSS rule to the body element:

body {
  margin: 0;
  color: #000;
  background: #fff;
}
.next-error-h1 {
  border-right: 1px solid rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) {
  body {
    color: #fff;
    background: #000;
  }
  .next-error-h1 {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
  }
}

Which means that we ought to inject our own CSS rule, in a way that would have higher specificity, this starts to get out of hand really quick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions