Freeze screen & inspect disappearing elements #DevToolsTips

Chrome for Developers · Beginner ·🌐 Frontend Engineering ·1y ago

Key Takeaways

The video demonstrates 6 ways to inspect disappearing elements in Chrome's DevTools, including forcing :hover and pseudo classes, emulating a focused page, removing JavaScript events, and using the debugger statement to freeze the screen.

Full Transcript

[Music] trying to inspect an element and it's gone it's like your C is playing hide and sick with you but don't worry chome death tools is here to help you catch those sneaky elements one common scenario is that elements disappear when you move your mouse away this often happens because of the CSS how state go to the elements panel find the parent element that's giving you trouble then in the Styles tab activate the how state to keep the element visible see you have Frozen it now you can change the Styles while it's stuck there this works for other CSS States as well sometimes elements disappear when day or the whole page loses Focus this can happen with drop downs two tips or other interactive elements for example bootstraps popovers disappear when you click somewhere else they use the pages Focus event to determine the dismissal which you can check in the console with document. has Focus the moment you click on the page it returns true when you click on left tools the page loses Focus making the pop over disappear to fix this you have to trick the page into thinking it is always focus in the Styles tab enable the emulate the focus page option it's like a magic spell that keeps everything visible this setting used to be hidden in the rendering panel we recently added a shortcut in the Styles tab to make it easier to find this is a global setting that persists once you enable it it will always be on HM one thing to note though if you're using the page visibility API make sure to turn it off when you're debugging user interactions that depend on it for example if you have a script that runs when the page is fading in the background the visibility change event won't fire the document do visibility state will remain visible now what about other cases where JavaScript is involve often elements are removed or hidden because of events like BL Mouse out or custom events there are two options to freeze this elements in this example the card preview shows and Heights based on the mouse over and mouse Le event select the parent element in the Dom tree and open the event listeners tab expand the mouse LIF event and you can remove it now the popup shows and never leaves edit all you want then reload the page to reset the listener again removing listeners is helpful but sometimes you might want to keep the event instead you can use the Breckon options to debug disappearing elements if you look closely when you how over the button it changes the CSS class name of the card preview let's right click on it and choose break on there are three options here in our case we want to freeze the screen when the CSS class name changes so we'll choose attribute modifications the right choice depends on what you are doing you might want to pause on remover or when sub elements change you have to observe and decide great when we how again it breaks right at the beginning of the class name change step over it and you can see the card preview keep it this way and you can inspect and change the Styles as you need all the Breck points you added in the Dom are shown in the Dom brick points tab be sure to clear them out when you are done actually since our example is so simple we can just edit the Dom to add the class name ourself this is even faster here come the best solution when you need a quick face and don't care how the element is disappearing try this freeze techniques the debugger statement can help you freeze the screen so what you can do is delay it for a certain amount of time with set time out this code gives you a 3 second countdown before freezing everything do what you need to do before it ends here is a bonus tip save the code as a snipper so you can just run it the next time you have the same problem I name the snipper freeit 3,000 you can name it as you wish once you save the snipper you can run it over and over again even better you can run it from anywhere open the command menu again with command or control shift p then use the exclamation mark to select and run our free script all right now we know six ways to freeze the screen and debug disappearing Elements which one is your favorite leave your comments below that's all for now good luck debugging see you in the next step two tips ciao [Music]

Original Description

Trying to inspect an element, and “poof” it's gone? It's like your code is playing hide-and-seek with you! Don't worry, learn these 6 ways to inspect disappearing elements in Chrome's DevTools! Chapters: 0:00 Intro 0:20 Force :hover & pseudo classes 0:51 Emulate a focused page 2:20 Remove JavaScipt event listeners 3:01 Set DOM breakpoints 4:08 Edit HTML and CSS classes 4:18 Set timeout with snippets Resources: Learn DevTools Snippets → https://goo.gle/3Wh8iWr Page Visibility API → https://goo.gle/3WkDvYI Coffee demo → https://goo.gle/4bZKmN7 Bootstrap demo → https://goo.gle/3ydBzcx Profile demo: → https://goo.gle/3WL22YF Questions? Tweet to us: Jecelyn Yeen → https://goo.gle/jecfish Chrome DevTools → https://goo.gle/chromedevtools Watch more DevTools Tips → https://goo.gle/DevToolsTips Subscribe to Chrome for Developers → https://goo.gle/ChromeDevs #DevToolTips #ChromeForDevelopers #Chrome Speaker: Jecelyn Yeen
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Chrome for Developers · Chrome for Developers · 0 of 60

← Previous Next →
1 Polymer Performance Patterns (The Polymer Summit 2015)
Polymer Performance Patterns (The Polymer Summit 2015)
Chrome for Developers
2 Polymer Power Tools (The Polymer Summit 2015)
Polymer Power Tools (The Polymer Summit 2015)
Chrome for Developers
3 Chrome Dev Summit 2014 – Chrome Case Studies
Chrome Dev Summit 2014 – Chrome Case Studies
Chrome for Developers
4 Web Directions Code 2015 round up
Web Directions Code 2015 round up
Chrome for Developers
5 Maintainable Code - HTTP203
Maintainable Code - HTTP203
Chrome for Developers
6 iron-ajax… wat?! -- Polycasts #26
iron-ajax… wat?! -- Polycasts #26
Chrome for Developers
7 The Guardian - Supercharged
The Guardian - Supercharged
Chrome for Developers
8 ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
Chrome for Developers
9 #AskPolymer: Rob answers all the questions ever -- Polycasts #27
#AskPolymer: Rob answers all the questions ever -- Polycasts #27
Chrome for Developers
10 The Future of JavaScript - HTTP203
The Future of JavaScript - HTTP203
Chrome for Developers
11 Data Binding 101 -- Polycasts #28
Data Binding 101 -- Polycasts #28
Chrome for Developers
12 The Guardian part 2 - Supercharged
The Guardian part 2 - Supercharged
Chrome for Developers
13 The Future of Web Audio: with Chris Wilson and Chris Lowis
The Future of Web Audio: with Chris Wilson and Chris Lowis
Chrome for Developers
14 Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome for Developers
15 Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Chrome for Developers
16 #AskPolymer: How do you make the show? -- Polycasts #29
#AskPolymer: How do you make the show? -- Polycasts #29
Chrome for Developers
17 Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Chrome for Developers
18 Binding to Objects -- Polycasts #30
Binding to Objects -- Polycasts #30
Chrome for Developers
19 Player FM - Supercharged
Player FM - Supercharged
Chrome for Developers
20 Where’s the Designer? #AskPolymer -- Polycasts #31
Where’s the Designer? #AskPolymer -- Polycasts #31
Chrome for Developers
21 Jake Beats Wikipedia - HTTP203
Jake Beats Wikipedia - HTTP203
Chrome for Developers
22 Supercharged Observers! -- Polycasts #32
Supercharged Observers! -- Polycasts #32
Chrome for Developers
23 Jai's Web blog - Supercharged
Jai's Web blog - Supercharged
Chrome for Developers
24 Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Chrome for Developers
25 What about internationalization? #AskPolymer -- Polycasts #33
What about internationalization? #AskPolymer -- Polycasts #33
Chrome for Developers
26 Developing for Billions (Chrome Dev Summit 2015)
Developing for Billions (Chrome Dev Summit 2015)
Chrome for Developers
27 Google+ Performance Improvement Comparison
Google+ Performance Improvement Comparison
Chrome for Developers
28 Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Chrome for Developers
29 Progressive Web Apps (Chrome Dev Summit 2015)
Progressive Web Apps (Chrome Dev Summit 2015)
Chrome for Developers
30 Instant Loading with Service Workers (Chrome Dev Summit 2015)
Instant Loading with Service Workers (Chrome Dev Summit 2015)
Chrome for Developers
31 Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Chrome for Developers
32 Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Chrome for Developers
33 Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Chrome for Developers
34 Polymer - State of the Union (Chrome Dev Summit 2015)
Polymer - State of the Union (Chrome Dev Summit 2015)
Chrome for Developers
35 Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Chrome for Developers
36 Introduction to RAIL (Chrome Dev Summit 2015)
Introduction to RAIL (Chrome Dev Summit 2015)
Chrome for Developers
37 DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
Chrome for Developers
38 RAIL in the real world (Chrome Dev Summit 2015)
RAIL in the real world (Chrome Dev Summit 2015)
Chrome for Developers
39 #ChromeDevSummit talks are up - W00T! -- Polycast #34
#ChromeDevSummit talks are up - W00T! -- Polycast #34
Chrome for Developers
40 V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
Chrome for Developers
41 Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Chrome for Developers
42 Owning your performance: RAIL (Chrome Dev Summit 2015)
Owning your performance: RAIL (Chrome Dev Summit 2015)
Chrome for Developers
43 HTTP/2 101 (Chrome Dev Summit 2015)
HTTP/2 101 (Chrome Dev Summit 2015)
Chrome for Developers
44 Leadership Panel (Chrome Dev Summit 2015)
Leadership Panel (Chrome Dev Summit 2015)
Chrome for Developers
45 Build Processes, Totally Tooling Tips (S2, Ep 5)
Build Processes, Totally Tooling Tips (S2, Ep 5)
Chrome for Developers
46 Accessibility (Chrome Dev Summit 2015)
Accessibility (Chrome Dev Summit 2015)
Chrome for Developers
47 Binding to Arrays -- Polycasts #35
Binding to Arrays -- Polycasts #35
Chrome for Developers
48 HTTP2 - HTTP203
HTTP2 - HTTP203
Chrome for Developers
49 Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome for Developers
50 Call For Submissions - Supercharged
Call For Submissions - Supercharged
Chrome for Developers
51 Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Chrome for Developers
52 Testing AJAX with Web Component Tester -- Polycasts #37
Testing AJAX with Web Component Tester -- Polycasts #37
Chrome for Developers
53 Slack: Extended Xmas Special - Supercharged
Slack: Extended Xmas Special - Supercharged
Chrome for Developers
54 Browser testing with Travis & Sauce Labs -- Polycasts #38
Browser testing with Travis & Sauce Labs -- Polycasts #38
Chrome for Developers
55 Optimize for production with Vulcanize -- Polycasts #39
Optimize for production with Vulcanize -- Polycasts #39
Chrome for Developers
56 Highlights from Chrome Dev Summit 2015
Highlights from Chrome Dev Summit 2015
Chrome for Developers
57 Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome for Developers
58 Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Chrome for Developers
59 How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
Chrome for Developers
60 Colors – DevTools Tonight #0 (Pilot)
Colors – DevTools Tonight #0 (Pilot)
Chrome for Developers

This video teaches you how to inspect disappearing elements in Chrome's DevTools using 6 different methods, including forcing :hover and pseudo classes, emulating a focused page, and using the debugger statement to freeze the screen. By mastering these techniques, you'll be able to debug web applications more efficiently.

Key Takeaways
  1. Force :hover and pseudo classes to inspect elements
  2. Emulate a focused page to prevent elements from disappearing
  3. Remove JavaScript events to freeze elements
  4. Use the debugger statement to freeze the screen
  5. Add a breakpoint to debug disappearing elements
  6. Use the Elements panel to inspect and modify CSS styles
💡 The key to debugging disappearing elements is to use the right technique at the right time, whether it's forcing :hover and pseudo classes, emulating a focused page, or using the debugger statement to freeze the screen.

Related Reads

📰
I built 42 landing page templates as single HTML files (no npm, no build step)
Learn how to create simple landing page templates as single HTML files without relying on npm or build steps, and why this approach matters for efficient web development
Dev.to · Segcam spa
📰
Part 7B — Section 2 — React Event Handling Explained: Forms, Event Object & User Input.
Learn React event handling for forms and user input to improve your frontend skills
Medium · JavaScript
📰
Stop Using window.resize for Everything: A Practical Guide to the ResizeObserver API
Learn to replace window.resize with the ResizeObserver API for more efficient and effective resize event handling
Medium · JavaScript
📰
Rendering Lists and Handling Events
Learn to render lists and handle events in web development to create interactive user interfaces
Dev.to · Silas

Chapters (7)

Intro
0:20 Force :hover & pseudo classes
0:51 Emulate a focused page
2:20 Remove JavaScipt event listeners
3:01 Set DOM breakpoints
4:08 Edit HTML and CSS classes
4:18 Set timeout with snippets
Up next
Elementor Angie Ai Plugin Tutorial
Quick Tips - Web Desiign & Ai Tools
Watch →