Uc Devtools offers a suite of tools for browser profiling and optimization, including the Chrome DevTools and the Firefox Developer Edition. These tools provide a comprehensive set of features for debugging and optimizing web applications.
With the Chrome DevTools, you can use the Performance panel to analyze the performance of your web application, identifying bottlenecks and areas for improvement. The panel provides a detailed breakdown of CPU usage, memory allocation, and other key metrics.
The Firefox Developer Edition also includes a range of profiling tools, including the Profiler and the Memory Tool. These tools allow you to monitor and analyze the performance of your web application in real-time, identifying issues and optimizing code for improved performance.
Browser Profiling
Browser profiling is a crucial step in web development, allowing you to test and optimize your website's performance and accessibility.
We create separate browser profiles for each task, typically 5 user profiles, each with its own extensions, bookmarks, and features turned on or off. This setup makes it easy to switch between profiles and get right to work on performance debugging or accessibility auditing.
A clean browser profile is essential for profiling a website for performance or tracking accessibility issues. We work with a dedicated Accessibility profile, which includes tools like Accessibility Insights, aXe, and a11y.css.
Here are the 5 user profiles we typically work with:
- Accessibility profile: A clean browser profile with accessibility tools and features.
- Debugging profile: A profile with experimental settings for profiling and a custom diagnostics CSS.
- Performance profile: A clean profile without extensions, with bookmarks for auditing and performance-related links.
- Happy customer: A profile based on common user data, with popular extensions and no throttling.
- Unhappy customer: A profile for a user on a slow, throttled connection, with 10 popular browser extensions.
Creating Browser Profiles
Creating browser profiles is a game-changer for web development. It allows you to quickly switch between different scenarios and environments, making it easier to identify and fix performance and accessibility issues.
Having at least 5 user profiles is a good starting point. Each profile should have its own unique set of extensions, bookmarks, and browser settings.
For accessibility auditing, a clean browser profile with tools like Accessibility Insights, aXe, and a11y.css is essential.
A debugging profile with experimental settings and DevTools enabled can also be very helpful.
A performance profile without extensions and with special bookmarks for auditing can help you identify performance issues.
A happy customer profile with popular extensions and common web development tools is a great reference point for how real users experience your site.
An unhappy customer profile with a slow connection, low memory, and poor CPU can help you identify the worst-case scenario for your users.
Here are the different profiles you might consider creating:
- Accessibility profile: includes tools for checking accessibility
- Debugging profile: includes experimental settings and DevTools
- Performance profile: includes special bookmarks for auditing
- Happy customer profile: includes popular extensions and common web development tools
- Unhappy customer profile: includes a slow connection, low memory, and poor CPU
Keeping each profile clean and uncluttered is essential, including browser extensions, bookmarks, cookies, and cache.
Expanding Nodes Recursively
Expanding nodes recursively is a game-changer for browser profiling. You can right-click on the arrow on a node and choose "Expand recursively" to expand the currently-selected node and all of its children with one single click.
Alternatively, you can hold Option (or Ctrl + Alt on Windows) while clicking the arrow icon next to the element’s name to achieve the same result. This can save you a lot of time when inspecting deeply nested DOMs.
Debugging Tools
You can use the media query debugger in Chrome and Edge to keep track of styles being overwritten by other styles scoped within a media query. The debugger is hidden away behind the "Settings" cog in the device toolbar, but it's quite helpful when it's available by default.
To access the media query debugger, toggle the device toolbar (responsive mode) with Cmd/Ctrl + Shift + M and choose the three dots in the right upper corner. Then choose "Show media queries" to see horizontal bars representing the scope of each media query.
You can track which media queries are being overwritten by hovering over the bars, and jump to a specific media query range to inspect layout issues in detail. By clicking on any position on a bar, you can trigger specific breakpoints, and right-click on a bar to reveal its position in the source code.
Here are some additional features of the media query debugger:
- You can specify custom emulated devices instead of the pre-defined ones
- You can use the "Sensors" pane to control specific device sensors if needed
- In Firefox, you can enable and disable touch simulation, and define a specific User Agent to check how the page behaves with a search engine crawler requesting the page
Media Queries Debugging
Debugging media queries can be a real challenge, but thankfully, there's a built-in media query debugger in Chrome and Edge that can help.
The media query debugger is hidden behind the device toolbar, which you can toggle with Cmd/Ctrl + Shift + M. To access it, choose the three dots in the right upper corner and select "Show media queries". This will display horizontal bars representing the scope of each media query.
These bars might look a bit confusing at first, but they're actually quite helpful. The way they're aligned represents screen width, with the bars closer to the center of the screen being overwritten by the ones further away from the center.
The blue bar on the top indicates max-width media queries, the green one min-width and max-width media queries, and the orange one stands for only min-width media queries. By hovering over the bars, you can track which media queries they contain.
You can also jump to a specific media query range and inspect layout issues in detail with the Styles panel open. By clicking on any position on a bar, you can trigger specific breakpoints, and right-clicking on a bar will reveal its position in the source code.
Global Keyboard Shortcuts
Debugging can be a tedious task, but knowing the right keyboard shortcuts can make all the difference. With so many features available in DevTools, it's easy to get lost between tabs, panels, and gear icons. But don't worry, there are some global keyboard shortcuts that can help you jump to specific features faster.
Cmd/Ctrl + Shift + P is a game-changer, as it opens a quick autocomplete search for panels, drawers, and all the features within DevTools. This shortcut is available in Chrome and Edge.
If you need to quickly access any DevTools feature, the Command Menu is a quick way to get there. You can also use it to access general drawers, hidden menus, or specific features.
To open DevTools Settings, you can use Shift + ? in Chrome or F1 in Firefox. This is especially useful when you need to access obscure tools and features hidden in the Settings panel.
Toggle Inspect Element Mode with Cmd/Ctrl + Shift + C to avoid clicking on an Inspect icon and then focusing on the element you'd like to debug.
Here are some essential global keyboard shortcuts to keep in mind:
- Cmd/Ctrl + Shift + P: Opens the Command Menu (Chrome, Edge)
- Shift + ?: Opens DevTools Settings (Chrome)
- F1: Opens DevTools Settings (Firefox)
- Cmd/Ctrl + Shift + C: Toggles Inspect Element Mode
- Fn + F2 (or F2 on Windows): Toggles the HTML mode on the currently selected element
- Cmd/Ctrl + Shift + M (Chrome) or Cmd/Ctrl + Opt/Alt + M (Firefox): Toggles Device mode
These shortcuts can save you a lot of time and effort when debugging.
Dock States
The dock in DevTools can be a bit finicky, but there's a simple shortcut to switch between its states: Cmd/Ctrl + Shift + D. This will quickly toggle between the default position and the one you've changed it to.
In some cases, the dock might work better on the right-hand side, and in others, at the bottom – it all depends on the layout of your DOM tree.
If you're working on accessibility checks, you can use the :hov toggle button to force an element state, such as :focus and :active on buttons. This can be a huge help in testing your code.
In Firefox, you can even change a pseudo-class for a DOM element as you're inspecting it – just right-click on the node.
Tracking Changes
Tracking changes while debugging can be a real pain, but fortunately, there are some great tools to help you out.
Chrome has a "Local Modifications" command that allows you to track changes in the source file.
You can toggle this command when editing the source file and a tracker of changes will appear in the panel below. If it's collapsed, pull it out by dragging it vertically.
The pane highlights changed properties and what exactly has changed, so you can copy-paste modifications right away.
It's a good idea to track changes while running your local server, as automatic removal of line breaks and spaces can cause issues.
This problem doesn't exist in Firefox, where you can find a "Changes" pane that does the same thing, along with a friendly button "Copy All Changes".
Filtering by Property
Filtering by Property can be a game-changer in debugging. It helps you quickly identify and isolate the styles that are affecting a particular property.
Firefox DevTools offer a feature to filter all styles by a particular property, indicated with a filter icon. This is especially useful when you notice that some styles are being overwritten by others scattered across the stylesheet.
By hiding all the definitions that don't affect a particular property, you can see exactly where the overrides are happening. This saves you time and effort in debugging.
You can also highlight all instances that match a particular selector, making it easier to find the source of a bug. For example, if you notice a bug with rendering of profile images on dark and light sections of the page, you can highlight all instances of a particular class.
Sources
- https://www.smashingmagazine.com/2021/02/useful-chrome-firefox-devtools-tips-shortcuts/
- https://ceas.uc.edu/about/college-computing/software/microsoft-azure.html
- https://www.ultraedit.com/support/tutorials-power-tips/uestudio/integrated-debugger/
- https://developer.nvidia.com/texture-tools-exporter
- https://ceas.uc.edu/research/centers-labs/structural-dynamics-research-laboratory/software.html
Featured Images: pexels.com