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

Check cssRules before css variables are read from stylesheet (again) #2580

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

floriangantner
Copy link
Contributor

@floriangantner floriangantner commented Oct 26, 2023

References

Description

check stylesheets in the dom before reading the css variables from them. If some error occurs reading the stylesheet cssRules (see the issue, f.e. it is some cross-origin stylesheet from some plugin which is not-readable) the exception is catched and the css variable not extracted from the stylesheet.

Instructions for Reviewers

see #2450 and #2557 and the previous PR #2454 for an overview over the discussion, especially the exception and the difference to the previous PR.

Include guidance for how to test or review your PR.

See the issue for details how to reproduce the bug with specific browser addons that inject stylesheets into the DOM.
Also login into the system (e.g. dspace sandbox) and see the admin sidebar if everything works (#2557) , especially by controlling the browser console for unexpected errors.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

… get from stylesheet

check the existence off cssRules property before the variables are readed from this stylesheet
DSpace#2450
@tdonohue tdonohue self-requested a review October 26, 2023 15:19
@tdonohue tdonohue added bug high priority themes port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release labels Oct 26, 2023
@tdonohue
Copy link
Member

Thanks @floriangantner for the follow-up work! I'll give this a test myself in the next few days to verify it works & solves the issues that we previously ran into with #2454

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thank you so much @floriangantner for sticking with this and finding a solution that works!

I reviewed/tested this today. I can verify it fixes the blank page bug when running Firefox + DarkMode extension. I can also verify that no errors are thrown in the DevTools Console. Also tested on Chrome and found no errors or issues there. Finally, I also verified that the #2557 bug (which was caused by the last version) does NOT exist in this PR. So, this now seems like a correct fix!

@tdonohue tdonohue added this to the 8.0 milestone Oct 27, 2023
@tdonohue tdonohue merged commit e1e2941 into DSpace:main Oct 27, 2023
11 checks passed
@dspace-bot
Copy link
Contributor

Successfully created backport PR for dspace-7_x:

@tdonohue tdonohue removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

blank page on certain browser plugins injecting stylesheets
3 participants