Specific blog post title, eh? But very specific problem that’s a pain in the backside when it comes to debugging it.

How do you inspect an element that hides on mouse move? Such as a tooltip (though I’m not a fan of the UI element, if only for the lack of accessibility) it’s certainly not obvious.

[I’ve published 38 videos for new developers, designers, UX, UI, product owners and anyone who needs to conquer the command line today.](https://training.leftlogic.com/buy/terminal/cli2?coupon=BLOG\&utm_source=blog\&utm_medium=banner\&utm_campaign=remysharp-discount)

This is a short post on how to keep elements from hiding allowing me to inspect the elements in devtools.

I’m also afraid that this only works in Chrome - because Firefox triggers a mouse move at the point I want to capture the newly visible element and thusly hides again before I can debug.

Here are the steps:

  1. Prepare by opening devtools and setting it open in a separate window (whilst in devtools, open the palette by using ctrl or cmd + p - then type >undock)

  2. Now focusing on the browser window again, hover over the triggering element and leave the mouse pointer where it is

  3. Using the keyboard switch focus to devtools - on a mac that’s cmd+ ` (backtick), otherwise you can use the "Developer Tools" shortcut (again, mac is cmd+alt+I)

  4. Now in the console type debugger - if you’re not focused on the console, switch using ctrl or cmd + [ and ] to move panels

  5. Now the browser is in a hung mode, no JavaScript can run, you’re free to inspect the exposed element and debug the CSS.

If those steps weren’t entirely obvious, I’ve included a video walk-through below:

That all said and done, I had to debug an existing system, but when it comes to hover effects, at the very least toggling a CSS class makes it a lot easier to debug. It also means it can be a default state of shown if there’s no JavaScript (for instance).

Even better: don’t resort to help that’s hidden to the visitor by default!

πŸ‘ 22 likes

[![𝖲𝗍𝖾𝗓](https://webmention.io/avatar/pbs.twimg.com/4ad3c7a4739dbf947de798949883e7fb9ab01e72d9618a40b9912fa131389972.jpg "𝖲𝗍𝖾𝗓")](![Marcus Relacion(https://webmention.io/avatar/pbs.twimg.com/55073266942c53a87578eb9f073c6d78cd9431218ff5f308050d6cb988670080.jpg "Marcus Relacion")](![Rafael E. Belliard(https://webmention.io/avatar/pbs.twimg.com/723336c4b32ba5be752d0cecc84b6d7b4e5e453ea4500f2c9d34dd176500a0dd.jpg "Rafael E. Belliard")](![Ruud SteltenpoolπŸ€”πŸ”—πŸ“ŠπŸš²πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘§πŸ’ΎπŸŒ³(https://webmention.io/avatar/pbs.twimg.com/863b022cf6947e5797636020122106eeaf18254dd81bfe5323e85bfbba3a1015.jpg "Ruud SteltenpoolπŸ€”πŸ”—πŸ“ŠπŸš²πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘§πŸ’ΎπŸŒ³")](![Dony Sukardi(https://webmention.io/avatar/pbs.twimg.com/b288b79305e52992754cd1f7d7fefc62183d52118caabbf8577d5986fbae881e.jpg "Dony Sukardi")](![Sarah MΓ€rdian(https://webmention.io/avatar/pbs.twimg.com/046538815410524d6d6e019a75b0883a63c220e3010ad208445c7d9cfd4c009c.png "Sarah MΓ€rdian")](![Tomas Hrobarik(https://webmention.io/avatar/abs.twimg.com/0e6b2cd70aa5b35dec24ca4e1e63f8963f0118736d9ec3bba77e3a8c99a27bc2.png "Tomas Hrobarik")](![Ryan Mulligan(https://webmention.io/avatar/pbs.twimg.com/83ecdd1f7b2d6a7a90e86802aa1ae6c2e0d2819b83db984892f9c0be96584092.jpg "Ryan Mulligan")](![Bramus!(https://webmention.io/avatar/pbs.twimg.com/05867d2965ead9c19f56436d55d4f94c52262b3b51dae292b9b9f45fa2a96995.jpg "Bramus!")](![iurii kucherov(https://webmention.io/avatar/pbs.twimg.com/7ef024e036a66d271f6423c549bf3f1e076ef4ebca143d2875737f092ce9ba28.jpg "iurii kucherov")](![Fabian(https://webmention.io/avatar/pbs.twimg.com/f6117e0df832dc90c0ad8c97ea97aab723385fd2b012e7133e66e6f72774ac20.jpg "Fabian")](![John Liu(https://webmention.io/avatar/pbs.twimg.com/0c96ad4e9745e5dc52fb93334aa22910527a8b42085e950935d9f3c5381a5530.jpg "John Liu")](![HJ Chen | ι™ˆζ…§ζ™Ά(https://webmention.io/avatar/pbs.twimg.com/8a1b4eae10cff541cb3cb18b297f3e17812b3ca8acff198732233a1a0b4e11e1.png "HJ Chen | ι™ˆζ…§ζ™Ά")](![YetAnotherFrank *trΓ€gt Maske\* πŸ—Ώ(https://webmention.io/avatar/pbs.twimg.com/be0682b9abfa2b250b9d927607eef4a51e1fdfb8f957039970de200514f1fdeb.png "YetAnotherFrank trΓ€gt Maske πŸ—Ώ")](![𝐍𝐚𝐭𝐚π₯𝐒𝐞 𝐝𝐞 π–πžπžπ«π(https://webmention.io/avatar/pbs.twimg.com/df715e6bc80d755d207111f9476417e17d08a5a7720e77ea627db24da079302a.png "𝐍𝐚𝐭𝐚π₯𝐒𝐞 𝐝𝐞 π–πžπžπ«π")](![Nelson Rodrigues(https://webmention.io/avatar/pbs.twimg.com/e3e2ba244838c088e6065a89b0ddbf667cd44a28694904cf7d63ffd7ca4055a1.jpg "Nelson Rodrigues")](![joel(https://webmention.io/avatar/pbs.twimg.com/5e7a1bbc0379b9ea42efe71a05a8306f3d64373770789423f9f1a4a9640fc7f1.jpg "joel")](![Mike Stenhouse(https://webmention.io/avatar/pbs.twimg.com/41109685d4b0e4dea1141302c30565fc6edc69012cc2616100d49b6ce41a8455.jpg "Mike Stenhouse")](![Patrick Long(https://webmention.io/avatar/pbs.twimg.com/177e57c2b3ab826cc632874a6a034940a6edce859716f15579775667aa0e80f6.jpg "Patrick Long")](![Matthias Rolke(https://webmention.io/avatar/pbs.twimg.com/460b893156a4782b1cf7a679e10920a4151c87627cc88637b30573b3d38bf2e8.jpg "Matthias Rolke")](![Haden(https://webmention.io/avatar/pbs.twimg.com/4e7fa4cf9546993632e600c7bb37d07e80eda416e785a200ab8fed0850c4bb87.jpg "Haden")](![Peter Nguyen(https://webmention.io/avatar/pbs.twimg.com/220a905bc2ed540604fbb3db2c51cc27ca6bbb41f0f330e05cb85b0a87f230d9.jpg "Peter Nguyen")](https://twitter.com/iampeteo)

Comments

Lock Thread

Login

Add Comment[M ↓ Β  Markdown]()

[Upvotes]()[Newest]()[Oldest]()

0 points

7 months ago

Nice!

0 points

16 months ago

I don’t know what kind of wizardry they pulled up but this technic or f8 or ctrl+\ did not work when inspecting a picker on an external site. So if anyone tries this without much success, make a [bookmarklet](https://caiorss.github.io/bookmarklet-maker/) with a single debugger; statement in it and press when the thing you want to inspect is open.

This worked for me in chrome, windows 10, in 2022

1 point

2 years ago

Nice tip. Another option would be to right-click on the body and add a DOM/attribute modification event breakpoint, the bonus doing it that way is you can stack trace the code too.

R

[Rafael Bardini](https://rbardini.com)

0 points

2 years ago

You can also use F8 or ⌘ \ to pause script execution.

0 points

2 years ago

Another method: DevTools → Element (Inspect) Panel → Right Click on Elment to Hover → Force State on :hover

0 points

2 years ago

Hover state only works for CSS based, this won’t for the JavaScript based mouse move driven showing.

[Commento](https://commento.io)