Web Crash Caused by Styles in Chrome

Oct 24, 2024 · 1 min read · 155 Words · -Views -Comments · Software & Tools
Chrome 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

What the bug is

When accessing the web page in Chrome, everything is normal, but the page crashes directly when the developer tools are opened. If the page is refreshed with the developer tools open, it crashes but usually loads and runs when the developer tools are closed.

https://i.imgur.com/FJtPLZ1.jpeg

Version: Chrome v130.0.6723.70. Version v129 usually works.

Code Analysis

Actual tests found that commenting out the following code resolves the issue:

::-ms-scrollbar { display: none; }

Solution

Directly switch to using:

scrollbar-width: 0;

To Reproduce

Visit the link below to reproduce the issue:

https://alanhe421.github.io/test-page/web-crash.html

Final Thoughts

This issue demonstrates how specific CSS properties can cause browser crashes, particularly in newer versions of Chrome. The ::-ms-scrollbar pseudo-element appears to conflict with Chrome’s developer tools in version 130+. Using the standard scrollbar-width: 0 property instead provides a more stable and cross-browser compatible solution for hiding scrollbars. Always test CSS properties across different browser versions to avoid such compatibility issues.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover