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

Does bluescreen.js really need to disable all other stylesheets? #533

Closed
adrianbj opened this issue Feb 1, 2022 · 7 comments
Closed

Does bluescreen.js really need to disable all other stylesheets? #533

adrianbj opened this issue Feb 1, 2022 · 7 comments

Comments

@adrianbj
Copy link
Contributor

adrianbj commented Feb 1, 2022

I have ace-editor embedded into a panel and when code creates an exception that results in the display of the bluescreen, it loops through all stylesheets and disables them. If I disable this block of code:

for (let i = 0; i < document.styleSheets.length; i++) {
let style = document.styleSheets[i];
if (!style.ownerNode.classList.contains('tracy-debug')) {
style.oldDisabled = style.disabled;
style.disabled = true;
styles.push(style);
}
}

all the styles I need for ace-editor remain intact.

I guess you're trying to make sure there are no styles that might mess with the look of the bluescreen, but it feels a bit too aggressive.

I know that it ignores <style class="tracy-debug"> but because ace-editor comes as a package I don't want to hack that to add the class.

Are there any other solutions that might work rather than disabling all other stylesheets?

Thanks.

@adrianbj
Copy link
Contributor Author

adrianbj commented Feb 2, 2022

I decided to add the tracy-debug class to all the documents stylesheets via JS, essentially negating that code referenced above. Close this if you want, although I still think there might be room for improvement, but obviously that is up to you :)

@dg
Copy link
Member

dg commented Feb 3, 2022

I guess it would be possible to change the behavior and use the same CSS reset as is used for the Debug bar.

@adrianbj
Copy link
Contributor Author

adrianbj commented Feb 3, 2022

I'm happy enough now, so maybe if it's not broke, then don't fix it?

As I mentioned elsewhere, I actually have to modify your CSS resets anyway because they were breaking ACE's CSS so I am worried if you do more on that front, I might need to make more hacks.

@dg
Copy link
Member

dg commented Feb 3, 2022

All right, I'm not changing it.

ad ACE: Hmm, I see there's a problem with width:initial for divs…

@adrianbj
Copy link
Contributor Author

adrianbj commented Feb 3, 2022

I see there's a problem with width:initial for divs…

Sorry, where are you seeing that issue? Have you been playing around with adding ACE to a panel?

The main thing I do is change #tracy-debug to #tracy-debug-bar in the first few declarations in Tracy/Bar/assets/bar.css

That change isn't ideal either, but at least it prevents the resets from affecting the panels.

@dg
Copy link
Member

dg commented Feb 3, 2022

Have you been playing around with adding ACE to a panel?

Yes. Problem is in specificity.

ACE declares .ace_text-layer { width: 10000px; } and Tracy reset declares #tracy-debug * { width: initial } and #tracy-debug * has higher specificity than .ace_text-layer.

I thought I could reduce the specificity by using a custom <tracy-div> tag.

@adrianbj
Copy link
Contributor Author

Just wanted to say a big thanks for this change - it's now much easier to style panels without hacking the core CSS files.

forrest79 pushed a commit to forrest79/tracy that referenced this issue Apr 1, 2022
forrest79 pushed a commit to forrest79/tracy that referenced this issue Apr 1, 2022
forrest79 pushed a commit to forrest79/tracy that referenced this issue Apr 2, 2022
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

No branches or pull requests

2 participants