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

Add errorOverlayTheme option to Astro config #5875

Closed
wants to merge 11 commits into from

Conversation

MoustaphaDev
Copy link
Member

@MoustaphaDev MoustaphaDev commented Jan 16, 2023

Changes

Add errorOverlayTheme option to configure the theme of the custom error overlay

Testing

Not sure if it's worth adding an E2E test for this

Docs

JSDOCS comments, will be pulled by the docs website

@MoustaphaDev MoustaphaDev requested a review from a team as a code owner January 16, 2023 20:14
@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2023

🦋 Changeset detected

Latest commit: 60a1509

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 16, 2023
@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label Jan 16, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

@bluwy
Copy link
Member

bluwy commented Jan 17, 2023

Maybe I've missed some discussion about this, but it feels a bit "extraneous" to add this option 🤔 Is the default automatic light-dark theme not desirable? Since it's a dev-only feature, I feel like we can be a bit opinionated to keep the config API clean.

@Princesseuh
Copy link
Member

Maybe I've missed some discussion about this, but it feels a bit "extraneous" to add this option 🤔 Is the default automatic light-dark theme not desirable? Since it's a dev-only feature, I feel like we can be a bit opinionated to keep the config API clean.

This was my opinion as well, but some people expressed that their setup (Linux people) didn't properly set the media query, so I feel like it could be harmless to add

I'd want it a bit simplified though, as right now it seems like a "major" change to the overlay code

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

@MoustaphaDev
Copy link
Member Author

Made a few changes to keep the error overlay code closer to what it was

@bluwy
Copy link
Member

bluwy commented Jan 17, 2023

This was my opinion as well, but some people expressed that their setup (Linux people) didn't properly set the media query, so I feel like it could be harmless to add

I see. I guess it's nice to have a way out then, but also it feels like they should get it fixed, and not needing to workaround it. If we do want to make this possible, I wonder if it make sense to support body.astro-light and body.astro-dark instead.

@MoustaphaDev
Copy link
Member Author

MoustaphaDev commented Jan 17, 2023

If we do want to make this possible, I wonder if it make sense to support body.astro-light and body.astro-dark instead.

Not sure what you're referring to here, if it can avoid changing the config object, I'd be happy to explore that path

@bluwy
Copy link
Member

bluwy commented Jan 17, 2023

I mean if the astro-dark class is attached to the body, the error overlay would render in dark mode. (Same for light mode) Though I'm actually not sure if this behaviour would work for web components.

@delucis
Copy link
Member

delucis commented Jan 17, 2023

Love the initiative on this feature! In general, offering choice here is an accessibility question so finding some way to let users select their preferred theme does seem a good idea.

I wonder if the issue here is where this new option is being set. Would it make sense to offer a dark/light/system theme selector in the browser which we can persist to localstorage? The error overlay is technically a website and that’s the usual UI for this kind of option.

My personal take is that this is less a project config option and more a personal preference. Maybe two devs work on a site and have different preferences. Setting this via the config file will only help one of them. But if they can store their preference in the browser, that personal preference applies just to them.

Copy link
Contributor

@aFuzzyBear aFuzzyBear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like this PR, but a part of me is thinking and its pure bikeshedding, but is errorOverlayTheme a suitable name for this, could we not make it a bit more generic and go with theme this way any future UI improvements or features could leverage the theme: 'dark' | 'light' | 'system' to provide a more coherent way of applying any future style changes.

@aFuzzyBear
Copy link
Contributor

Love the initiative on this feature! In general, offering choice here is an accessibility question so finding some way to let users select their preferred theme does seem a good idea.

I wonder if the issue here is where this new option is being set. Would it make sense to offer a dark/light/system theme selector in the browser which we can persist to localstorage? The error overlay is technically a website and that’s the usual UI for this kind of option.

My personal take is that this is less a project config option and more a personal preference. Maybe two devs work on a site and have different preferences. Setting this via the config file will only help one of them. But if they can store their preference in the browser, that personal preference applies just to them.

I do like this suggestion, putting it behind a toggle on the overlay itself, thats worth a look, great idea there 🧠 @delucis

Co-authored-by: Peter Singh <[email protected]>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

@MoustaphaDev
Copy link
Member Author

MoustaphaDev commented Jan 17, 2023

I wonder if the issue here is where this new option is being set. Would it make sense to offer a dark/light/system theme selector in the browser which we can persist to localstorage? The error overlay is technically a website and that’s the usual UI for this kind of option.

Thanks for your reviews @bluwy and @delucis.
@delucis, I like this idea a lot! This makes way more sense than adding an option to the user config.
I'll try to go that way

@MoustaphaDev MoustaphaDev marked this pull request as draft January 17, 2023 13:10
@MoustaphaDev
Copy link
Member Author

Superseded by #5884

@MoustaphaDev MoustaphaDev deleted the moustapha/configurable-overlay branch February 13, 2023 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants