Skip to content

Markdown code inside details tag not displayed in Firefox #372

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

Closed
mdjohns opened this issue Jun 9, 2023 · 1 comment · Fixed by #373
Closed

Markdown code inside details tag not displayed in Firefox #372

mdjohns opened this issue Jun 9, 2023 · 1 comment · Fixed by #373

Comments

@mdjohns
Copy link

mdjohns commented Jun 9, 2023

Screenshot

image

Essentially a markdown code block that is initially hidden in some way will end up with invalid dimensions once it is un-hidden. In my example, it's the <details> element, but seems similar in the linked issues. The problem is resolved when the browser window is resized.

const computedStyle = getComputedStyle(element)

I took a quick peek and the dimensions seem to be calculated in this hook, but I haven't looked deeper into why these calculations may be taking invalid values.

If anything jumps out to anyone, let me know. I may be able to find some time to look deeper at this.

@pomber
Copy link
Contributor

pomber commented Jun 9, 2023

Thanks for reporting and collecting all the links.

The workaround is to make sure that the component re-renders when the visibility change. In the details example that would be wrapping the code in a div, listening to the open event, and changing the key of the wrapper when the visibility changes.

I have an idea of how to fix it in Code Hike with a ResizeObserver, I'll give it a try today.

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 a pull request may close this issue.

2 participants