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