Sub topic 11
Testing navigation on real devices
Earlier chapters built three navigation patterns: the hamburger menu, the bottom tab bar, and the priority menu. This chapter covers how to check that they work. It assumes you have built at least one of those patterns, know the basics of browser DevTools, and can serve a page from your own computer.
Why emulation is not enough
Browser device emulation resizes the viewport and fakes touch events. It does not reproduce several things your navigation depends on:
- Real thumb reach on a real handset, which depends on the phone's size and how you hold it.
- Browser chrome that changes size, such as iOS Safari's collapsing address bar, which can cover or shift a fixed tab bar.
- Device safe areas, such as the home indicator. The
env(safe-area-inset-bottom)padding on the tab bar only has an effect if the viewport tag includesviewport-fit=cover. - Screen reader behavior, which differs between VoiceOver, TalkBack, and NVDA.
- System text size settings, which can make a priority menu overflow earlier than you expected.
Use emulation for quick iteration. Use real devices to decide whether the work is finished.
A test order that finds problems early
Run the cheapest checks first.
Keyboard pass
Put the mouse aside and use only the keyboard. Check each of these:
- Tab reaches the menu toggle, and the focus indicator is visible.
- Enter and Space open the menu. A real
<button>provides both without extra code. - After opening, Tab moves into the first link in the list.
- Escape closes the menu and returns focus to the toggle, as the script in the hamburger chapter does.
- Tab never lands on a link inside a closed menu. The
hiddenattribute removes those links from the tab order.
For the priority menu, also check that the More summary opens with Enter and that links moved into the overflow list are still reachable in a sensible order.
Screen reader pass
Turn on a screen reader and move through the page by swiping or with the virtual cursor. Use VoiceOver on iOS, TalkBack on Android, and NVDA or VoiceOver on a desktop.
Listen for these things:
- The toggle is announced as a button with its state, for example "Menu, button, collapsed". After activation it should say "expanded".
- The
<nav>is announced as a landmark with its label, such as "Main navigation". If you have two navs, each needs a distinctaria-label. - The current tab in the tab bar is announced as the current page.
- Closed menu items are skipped entirely.
If the state never changes, check that your script updates aria-expanded and hidden together.
Touch target audit
You can measure target sizes with a snippet pasted into the DevTools console. Open the menu first so its links are visible.
const MIN = 48;
const rows = [...document.querySelectorAll('nav a, nav button, #menu-toggle, summary')]
.map((el) => ({ el, rect: el.getBoundingClientRect() }))
.filter(({ rect }) => rect.width > 0 && rect.height > 0)
.filter(({ rect }) => rect.width < MIN || rect.height < MIN)
.map(({ el, rect }) => ({
text: el.textContent.trim(),
width: Math.round(rect.width),
height: Math.round(rect.height),
}));
console.table(rows);Hidden elements measure zero and are skipped, which is why the menu must be open. WCAG 2.2 sets a minimum of 24 by 24 CSS pixels, and 44 to 48 pixels is the common recommendation for primary navigation. Wide, short links often pass on width and fail on height.
Real device pass
- Start your dev server so it listens on all interfaces, not only
localhost. - Connect the phone to the same Wi-Fi network and open
http://<your-computer-ip>:<port>. - For debugging, use Safari Web Inspector for an iPhone or
chrome://inspectfor an Android phone connected by USB.
On the device, check the following:
- Reach every item with one thumb, with the phone held in each hand.
- Rotate to landscape. A fixed bottom bar can take a large share of a short screen.
- Scroll up and down and watch the tab bar as the browser toolbar collapses.
- Raise the system text size and the browser zoom. The priority menu should move more links into More, and no link should be cut off.
- Tap quickly and tap near the edges. Accidental taps on neighboring items point to targets that are too close together.
What to record
| Check | Pass condition |
|---|---|
| Keyboard | Every control reachable, Escape closes and restores focus |
| Screen reader | State and landmark announced, hidden items skipped |
| Target size | No visible control under 48px in either dimension |
| Safe area | Tab bar clears the home indicator |
| Text size | No clipped or unreachable links at large text |
| Orientation | Navigation usable in portrait and landscape |
Exercise
Your tab bar passes every check in desktop DevTools emulation, but on an iPhone its labels sit under the home indicator. What are the two most likely causes?
Show answer
The viewport meta tag is missing viewport-fit=cover, so env(safe-area-inset-bottom) resolves to 0. Or the tab bar has no bottom padding using env(safe-area-inset-bottom). Emulation does not model the home indicator, so only a real device (or a simulator that does) shows the problem.