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

Minor changes to fix compatibility with older browsers #2355

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jazzzny
Copy link

@Jazzzny Jazzzny commented Oct 26, 2024

This PR provides 2 changes to fix compatibility with older browsers.

  1. Older browsers that do not support the prefers-color-scheme media query will fail to load any CSS when the dark/light mode code is enabled.

Additionally, the W3 Specification states that the light theme should be loaded as a fallback if no preference is given.

This can trivially be resolved by removing the prefers-color-scheme: light media query from the light theme, to set it as the default if the browser does not handle the query.

Screen.Recording.2024-10-26.at.1.51.18.PM.mov

This does not impact browsers that support the query, as prefers-color-scheme takes priority over the "base" stylesheet:
Screenshot 2024-10-26 at 2 04 33 PM

  1. Older browsers do not support addEventListener on matchMedia, instead add a fallback using addListener.

@Jazzzny
Copy link
Author

Jazzzny commented Oct 26, 2024

Appended with a fallback for addEventListener. This makes the editor fully functional on every browser I have tested, back to Safari 5.1.7.

@Jazzzny Jazzzny changed the title Fix CSS compatibility with older browsers that do not support prefers-color-scheme & adhere to W3 specification Fix compatibility with older browsers that do not support prefers-color-scheme & adhere to W3 specification Oct 26, 2024
@Jazzzny Jazzzny changed the title Fix compatibility with older browsers that do not support prefers-color-scheme & adhere to W3 specification Minor changes to fix compatibility with older browsers Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant