Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The errorOverlay's themeSwitch does not work as expected. #10715

Closed
1 task done
liruifengv opened this issue Apr 8, 2024 · 1 comment · Fixed by #10661
Closed
1 task done

The errorOverlay's themeSwitch does not work as expected. #10715

liruifengv opened this issue Apr 8, 2024 · 1 comment · Fixed by #10661
Labels
- P2: nice to have Not breaking anything but nice to have (priority)

Comments

@liruifengv
Copy link
Member

liruifengv commented Apr 8, 2024

Astro Info

Astro                    v4.5.12
Node                     v18.16.1
System                   Windows (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Issue

The errorOverlay's themeSwitch does not work as expected.

How to reproduce

Prerequisites

  • User's system use dark mode
  • When the user first encounters the error page, open the errorOverlay.
  • No localstorage astroErrorOverlayTheme now.

Steps

  1. open the errorOverlay
  2. theme is detected as dark
  3. Click the themeSwitch
  4. themeSwitch's check status is wrong
  5. theme toggle also does not work

Video

astro-error-overlay.-.Compressed.with.FlexClip.mp4

Reason

  • When it is detected that the system is dark, it is not saved to localstorage.
  • isDark should be localStorage.astroErrorOverlayTheme === 'dark' || this?.classList.contains('astro-dark')

What's the expected result?

errorOverlay's themeSwitch works correctly

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-xx2wzh

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 8, 2024
@matthewp matthewp added the - P2: nice to have Not breaking anything but nice to have (priority) label Apr 8, 2024
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Apr 8, 2024
@matthewp
Copy link
Contributor

matthewp commented Apr 8, 2024

PR is here: #10661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants