From Friction to Flow: Debugging With Chrome DevTools

Rate this content
Bookmark

Coding and debugging should flow, not fizzle! Let's see what's new and improved in Chrome DevTools to make your web development & debugging journey smooth sailing.

This talk has been presented at JSNation 2024, check out the latest edition of this JavaScript Conference.

FAQ

The main focus of the talk is on removing frictions along the debugging journey to improve the debugging flow.

The speaker uses the personal story to illustrate how hidden tools in DevTools, much like the hidden electronic grass trimmer, can make tasks easier if discovered and utilized.

Chrome DevTools has removed certain warnings, like those from Chrome extensions' source maps, to reduce noise and distractions in the console.

The 'ignore content script' feature in DevTools ignores scripts injected by Chrome extensions during breakpoint debugging, helping focus on the relevant code.

Users can share their local overrides by setting up a GitHub repo for the override files, committing the code, and sharing it with colleagues.

In the Network panel, a triangle exclamation mark at the top indicates changes, and a purple dot next to the resource indicates it has been overwritten.

Users can request new features or report issues via crbug.com, Stack Overflow (using the Chrome DevTools tag), social media platforms, or by tagging Chrome DevTools or specific team members.

A new feature in DevTools includes a light bulb icon that, when clicked, provides explanations and potential fixes for errors.

You can overwrite network responses by right-clicking on a file in the Network panel, selecting 'Overwrite content,' and then editing the content as needed.

The 'Emulate a focus page' feature helps debug disappearing elements by keeping the page in a focus state, preventing elements from disappearing when DevTools is active.

Jecelyn Yeen
Jecelyn Yeen
32 min
13 Jun, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The Talk discusses the importance of removing frictions in the debugging process and being aware of the tools available in Chrome DevTools. It highlights the use of the 'Emulate a Focus Page' feature for debugging disappearing elements and the improvement of debugging tools and workflow. The Talk also mentions enhancing error understanding, improving debugging efficiency and performance, and the continuous improvement of DevTools. It emphasizes the importance of staying updated with new features and providing feedback to request new features.

1. Introduction to Chrome DevTools

Short description:

Today, I'm going to talk about Chrome DevTools or cars, but I want to focus on removing frictions along the debugging journey. Let me start with a personal story. My partner and I recently moved to a new house with a garden. As lazy people, we waited until the grass grew long before deciding to clean the garden. We found a pair of scissors in the garden but chose to do the job manually. After searching our messy cellar, we found an electronic glass trimmer and finished the job in 10 minutes. DevTools can be like hidden tools in your garage, sometimes hard to find when you need them the most. It's important to remove frictions in the debugging process and be aware of the tools available. For example, inspecting and debugging disappearing elements can be a common issue. Let me show you a demo of this problem.

Today, I'm going to talk about Chrome DevTools or cars, but I want to focus on the part that I'm most excited about. So, the first thing I want to talk about is how we try to remove the frictions along the debugging journey to make your debugging flow better.

So let me start with a personal story. Perhaps you have similar stories like that. So recently, my partner and I, we moved to a new house. The good thing is they have a garden. The bad thing is they have a garden which the grass grows from time to time. And then, as a lazy person, we wait until the last minute after the grass grows for a certain length. Then we try to, okay, we have to clean the garden now.

So we walk across the garden and we found that we actually have a pair of scissors in the garden to do the job, but we need to do that manually. That still do the work. And then after that, since we newly moved to the house, we vaguely remember that in the cellar, two level dowels in the garage, the landlord actually left us an electronic glass trimmer to do the stuff. And then we are also not sure whether the glass trimmer is there. It's faster, but we are not so sure. So guess which one we choose, the manual one or the automatic one? Yeah. So we choose the manual one because we think that we can live with that. So we decided that it should be just fast, one hour into the process of manually cutting, we finally went down to the cellar and then searched around the messy cellar, and then finally we found it and then we do the job under 10 minutes, done.

So the reason why I tell this story is not to tell you how lazy I am, it's not, but to think about what are the frictions that I can remove between this process of me fighting and then cutting the grass? How we remove the friction from this process in order to prepare for the next trim? If you think of it, DevTools, probably is like your, sometimes it's like your garage, it's like your cellar, two level dowels, we have a lot of these hidden tools that you might sometimes get it, know it from your colleague, but you know when you're really like, have a problem, and you try to debug it, and then you might find that oh, there's this feature, maybe it's too far away, I roughly remember that, sometimes you might be not enough time to do a Google search to get the result and then you just leave it wherever you can, try to debug the thing, and sometimes it's because the tool is really too hidden, or it could be sometimes that you don't know what you don't know. The tool exists, you don't even think about finding it and using that.

So take for an example, inspecting and debugging disappearing elements. So I guess a lot of us have these issues before, like if you're using Daisy UI or any UI that have a pop drop down, sometimes the drop down result or the styling is not correct, you want to sort of inspect the result and do some code changes, or the other one, probably you have a search drop down, like the YouTube one, that you want to inspect on the result and do something on it, or if you are using bootstrap, this is the pop over that has the questions. So let me do the demo now to show you the problem. Oh, by the way, the first slide that I showed just now is a real screenshot that I took from here. You can actually use %c in the console log to pass in your style, to style your message nicely like this. Cool.

Okay. Get back to the disappearing element. So let's say if I click on this dismissable pop over, I want to debug this thing. I want to change the style. So what I will do is that usually I will just click on the inspect icon.

2. Debugging Disappearing Elements

Short description:

Oh, my browser froze during a live demo, but I managed to open a new tab. If you face a scenario where an element disappears when clicked, instead of changing your code or using a set timeout, you can use a feature in DevTools called Emulate the focus page. It allows you to inspect the element and can be enabled globally.

Oh, my browser freeze. Let me just refresh that, do that again. Do that. Okay. Okay. The whole browser freeze. You know, this is doing live demo on the stage. Cool. I will open a new tab on it. Okay. I'm using Chrome Canary, by the way. This is cutting edge. Yeah. That's why that's what cutting edge means. Okay. Let me just open this one. Okay. Cool.

So you want to debug this. If you try to click on this icon and try to inspect it, you see? That thing is gone. How many of you faced this scenario before? Okay. So the way that you do this, maybe you go and change your code, or maybe you go and inject a set time out, like don't know how many seconds, in order for you to do the action quickly and then come back to the flow. So the thing is, this feature in DevTools that exists for probably five or six years already, but no one discovered that. But recently, we do something good. We make it slightly visible. So now if you go to the Elements panel, Styles tab, if you go to this hour button here, if you click on it, there is this function called Emulate the focus page. If you tap on that, now you can inspect it. And this checkbox itself, it is a global setting. You can just turn it on and never turn it off. Okay.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Modern Web Debugging
JSNation 2023JSNation 2023
29 min
Modern Web Debugging
Top Content
This Talk discusses modern web debugging and the latest updates in Chrome DevTools. It highlights new features that help pinpoint issues quicker, improved file visibility and source mapping, and ignoring and configuring files. The Breakpoints panel in DevTools has been redesigned for easier access and management. The Talk also covers the challenges of debugging with source maps and the efforts to standardize the source map format. Lastly, it provides tips for improving productivity with DevTools and emphasizes the importance of reporting bugs and using source maps for debugging production code.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
Debugging with Chrome DevTools
JSNation Live 2021JSNation Live 2021
11 min
Debugging with Chrome DevTools
Top Content
Here are some tips for better utilizing DevTools, including using the run command, customizing keyboard shortcuts, and emulating the focus effect. Learn how to inspect memory, use the network panel for more control over network requests, and take advantage of console utilities. Save frequently used code as snippets and use local overrides for easy editing. Optimize images by using a more optimized format like AVIF and track changes in the network panel to see the reduced data size.
Static Analysis in JavaScript: What’s Easy and What’s Hard
JSNation 2023JSNation 2023
23 min
Static Analysis in JavaScript: What’s Easy and What’s Hard
Static analysis in JavaScript involves analyzing source code without executing it, producing metrics, problems, or warnings. Data flow analysis aims to determine the values of data in a program. Rule implementation in JavaScript can be straightforward or require extensive consideration of various cases and parameters. JavaScript's dynamic nature and uncertainty make static analysis challenging, but it can greatly improve code quality.
Debugging a Non Reproducible Crash
React Advanced 2021React Advanced 2021
20 min
Debugging a Non Reproducible Crash
The Talk discusses a vicious bug that caused 20,000 crashes in a JS application. The bug was an array index out of bounds exception in the SimplePool class. The team used a debugger to analyze the bug and discovered a race condition caused by an upgrade to React Native SVG. They collaborated with React Native contributors to fix the issue and deployed a patched version. The Talk emphasizes the importance of using a crash reporting tool, monitoring release health, and learning from bugs and source code analysis.
JavaScript Source Maps, Can We Do Better?
JSNation 2023JSNation 2023
27 min
JavaScript Source Maps, Can We Do Better?
Source maps allow understanding of transpiled, bundled, or minified code. Debugging with post hoc and debug identifiers helps identify files. Issues with source maps include hash collisions and missing function names. Various techniques can be used to determine the function that caused an error. Source maps can store additional information and improvements can be made to path resolution and column positions. Code points and token positions can differ across browsers. Detecting source maps can be challenging without a standardized JSON schema.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Tracing: Frontend Issues With Backend Solutions
React Summit US 2024React Summit US 2024
112 min
Tracing: Frontend Issues With Backend Solutions
Featured WorkshopFree
Lazar Nikolov
Sarah Guthals
2 authors
Frontend issues that affect your users are often triggered by backend problems. In this workshop, you’ll learn how to identify issues causing slow web pages and poor Core Web Vitals using tracing.
Then, try it for yourself by setting up Sentry in a ready-made Next.js project to discover performance issues including slow database queries in an interactive pair-programming session.
You’ll leave the workshop being able to:- Find backend issues that might be slowing down your frontend apps- Setup tracing with Sentry in a Next.js project- Debug and fix poor performance issues using tracing
This will be a live 2-hour event where you’ll have the opportunity to code along with us and ask us questions.
React Performance Debugging
React Advanced 2023React Advanced 2023
148 min
React Performance Debugging
Workshop
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
The Clinic.js Workshop
JSNation 2022JSNation 2022
71 min
The Clinic.js Workshop
Workshop
Rafael Gonzaga
Rafael Gonzaga
Learn the ways of the clinic suite of tools, which help you detect performance issues in your Node.js applications. This workshop walks you through a number of examples, and the knowledge required to do benchmarking and debug I/O and Event Loop issues.
Solve 100% Of Your Errors: How to Root Cause Issues Faster With Session Replay
JSNation 2023JSNation 2023
44 min
Solve 100% Of Your Errors: How to Root Cause Issues Faster With Session Replay
WorkshopFree
Ryan Albrecht
Ryan Albrecht
You know that annoying bug? The one that doesn’t show up locally? And no matter how many times you try to recreate the environment you can’t reproduce it? You’ve gone through the breadcrumbs, read through the stack trace, and are now playing detective to piece together support tickets to make sure it’s real.
Join Sentry developer Ryan Albrecht in this talk to learn how developers can use Session Replay - a tool that provides video-like reproductions of user interactions - to identify, reproduce, and resolve errors and performance issues faster (without rolling your head on your keyboard).