Skip to content

Added accesibility for default system theme to p5.js-web-editor #3371

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

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

takshittt
Copy link
Contributor

@takshittt takshittt commented Mar 6, 2025

I added a button in the settings dropdown menu as "system preferences" which enables default system theme of the user to the p5.js web editor.
Fixes #3061

Changes: added accessibility for default system theme in the p5.js-web-editor

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #3061

@raclim raclim added Area:Accessibility Category for accessibility related features and bugs Area:CSS For styling or layout issues handled with CSS/SASS labels Mar 17, 2025
@yugalkaushik
Copy link
Contributor

To check the checkbox you can add x between the square brackets.

@takshittt
Copy link
Contributor Author

Reviewed and tested the implementation of the default system theme. Verified that theme switches correctly based on system preferences across supported browsers. Ready for review and merge.

@raclim
Copy link
Collaborator

raclim commented May 16, 2025

Thanks so much for working on this!

I just checked it out and can confirm that it seems to work so far! I'm not sure if this might've been mentioned somewhere already, but could you delve into why react-helmet-async is added? Was it specifically for testing?

@takshittt
Copy link
Contributor Author

The migration from react-helmet to react-helmet-async was primarily done for testing purposes, but not exclusively. It also helps maintain consistency between the testing and production environments. However, I realize this is a broader change that could affect the overall code workflow. I'm happy to switch back to react-helmet if you prefer.

@raclim
Copy link
Collaborator

raclim commented May 19, 2025

Thanks for providing the additional context!

In the React 19 docs, there's a section regarding Metadata, which provides more native support but also recommends using a supplementary library like react-helmet. I've also seen several sources mention that react-helmet is currently deprecated, so it might be worth investigating whether react-helmet-async is the better longterm choice.

As a note and reference to the work here so far, if we do decide to switch to a different metadata library, I think we could move away from using a utility file like update-helmet.js and do a complete refactor with the new library.

That said, I do think the inclusion of react-helmet-async feels out of scope for this PR/issue, which is focused on system preference theming, and might need some further research. Would you mind removing it from this PR for now? If you're interested, feel free to dive further into this and open an issue for it!

@takshittt
Copy link
Contributor Author

I've replaced react-helmet-async with react-helmet to simplify the setup and reduce dependencies.
Please review the changes and let me know if any adjustments are needed.

Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

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

Thanks so much for the update on this! I added in a few more notes/questions, but overall may look good to go soon!

@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since Helmet is currently a default export in this file, could we preserve that or is there a specific reason to update it to be a named one?

Copy link
Contributor Author

@takshittt takshittt May 21, 2025

Choose a reason for hiding this comment

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

The codebase uses named imports consistently, so introducing a default export would create inconsistency. While there's no technical limitation, named exports also align better with TypeScript, especially as the organization is migrating to it.
I'd love to hear your thoughts on this

@@ -1,7 +1,7 @@
import axios from 'axios';
import PropTypes from 'prop-types';
import React, { useEffect, useState } from 'react';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question as above!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same with this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Accessibility Category for accessibility related features and bugs Area:CSS For styling or layout issues handled with CSS/SASS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply user's system color-scheme preference as the default site theme
3 participants