LEARNING OBJECTIVES ⌵
- Implement a tier-based priority column system using responsive CSS media queries.
- Understand progressive disclosure principles to triage high-priority vs secondary data attributes.
- Build interactive expandable accordion row drawers (
<details>/<summary>and expandable child<tr>rows) to restore access to hidden columns on mobile. - Maintain screen reader comprehension and avoid orphaned tabular data during column suppression.
📖 The Mental Model & Story (Intuitive Foundation)
Imagine boarding a commercial airplane. When looking at the full flight manifest at the gate terminal, the flight coordinator sees 15 dense data fields per passenger: Seat Number, Full Legal Name, Frequent Flyer Tier, Ticket Class, Passport Number, Nationality, Luggage Tag Count, Meal Preference, Special Assistance, Booking Reference, Check-in Timestamp, Security Clearance, Connecting Flight, Gate Number, and Boarding Group.
Full Gate Manifest (15 Columns on 32" Desktop):
+------+---------------+-----------+----------+---------------+-----------------+-------------+
| Seat | Passenger | Tier | Class | Passport | Luggage Count | Meal | ...
+------+---------------+-----------+----------+---------------+-----------------+-------------+
| 14A | Sarah Jenkins | Diamond | First | US-89421094 | 2 checked | Vegan | ...
+------+---------------+-----------+----------+---------------+-----------------+-------------+
Flight Attendant Mobile Handheld (Triage Priority View):
+------+---------------+-----------+--------+
| Seat | Passenger | Tier | [ More ]
+------+---------------+-----------+--------+
| 14A | Sarah Jenkins | Diamond | [v] | -> Tapping expands drawer showing Passport, Luggage, Meal
+------+---------------+-----------+--------+
When a flight attendant walks down the narrow airplane aisle holding a compact mobile handheld device, they only need Seat Number, Name, and Status at a glance to guide passengers to their seats. If a passenger asks about their meal or luggage, the flight attendant taps an expand button on that specific row to slide open a detailed drawer containing the lower-priority attributes.
In web engineering, Priority Column Hiding applies this triage principle: display essential primary columns across all screen widths, hide secondary/tertiary columns at narrow breakpoints, and provide an interactive mechanism to inspect the hidden details on demand.
Technical Deep Dive & Specifications
The Priority Tier Matrix
To systematically control column visibility across viewports, we establish a standardized Priority Classification Hierarchy:
+-----------------------------------------------------------------------------------------------+
| Priority Tier | Classification | Visible Breakpoint | Example Fields |
+-----------------------------------------------------------------------------------------------+
| Priority 1 | Essential (Core)| All Viewports (>= 0px) | Entity Name, ID, Primary Status |
| Priority 2 | Important | Tablet & Desktop (>=640px)| Date, Category, Primary Metric |
| Priority 3 | Secondary | Desktop Only (>=1024px) | Subscriptions, Tags, Region |
| Priority 4 | Tertiary / Gran | Widescreen (>=1280px) | Timestamps, Hash IDs, Audit Logs |
+-----------------------------------------------------------------------------------------------+
CSS Utility Class Architecture
We map these priority tiers directly to reusable CSS classes:
/* Base: Mobile First (Hide everything except Priority 1) */
.col-p2,
.col-p3,
.col-p4 {
display: none;
}
/* Tablet (>= 640px): Reveal Priority 2 */
@media (min-width: 640px) {
.col-p2 {
display: table-cell;
}
}
/* Desktop (>= 1024px): Reveal Priority 3 */
@media (min-width: 1024px) {
.col-p3 {
display: table-cell;
}
}
/* Widescreen (>= 1280px): Reveal Priority 4 */
@media (min-width: 1280px) {
.col-p4 {
display: table-cell;
}
}
Breakpoint Behavior Breakdown:
Width < 640px: [ P1 (Name) ] [ Action Drawer (v) ]
Width 640-1023: [ P1 (Name) ] [ P2 (Category) ] [ P2 (Price) ] [ Action Drawer (v) ]
Width >= 1024px: [ P1 (Name) ] [ P2 (Category) ] [ P2 (Price) ] [ P3 (SKU) ] [ P3 (Stock) ]
The Progressive Disclosure Pattern (Expandable Child Rows)
Hiding data entirely without a fallback penalizes mobile users who require full access. The industry-standard solution is an Expandable Detail Drawer:
- On desktop, the toggle button column is hidden (
display: none), and all data columns are visible in the main row. - On mobile, secondary columns are hidden from the main row, and a toggle button column is displayed.
- Clicking the toggle button expands an auxiliary
<tr class="detail-row">containing a full list of the hidden data attributes.
Desktop Layout:
+--------------------------------------------------------------------------+
| Order ID | Customer | Product | Date | Amount | Status |
| #1001 | Alice Cooper | Cloud Server | 2026-08-20 | $499 | Active |
+--------------------------------------------------------------------------+
Mobile Layout (Collapsed):
+--------------------------------------------------------------------------+
| [>] #1001 | Alice Cooper | $499 |
+--------------------------------------------------------------------------+
Mobile Layout (Expanded Detail Drawer):
+--------------------------------------------------------------------------+
| [v] #1001 | Alice Cooper | $499 |
| +----------------------------------------------------------------------+ |
| | Product: Cloud Server Dedicated | Date: 2026-08-20 | Status: Active | |
| +----------------------------------------------------------------------+ |
+--------------------------------------------------------------------------+
💻 Interactive Code Playground
Starter Code
Line-by-Line Code Breakdown
- Lines 73–92: Priority utility media queries. Classes
.p-priority-2and.p-priority-3remaindisplay: noneon mobile screens and activate intodisplay: table-cellas the viewport reaches tablet ($640\text{px}$) and desktop ($1024\text{px}$) thresholds. - Lines 93–99: When the screen is wider than $1024\text{px}$, the toggle button column (
.col-toggle) is suppressed (display: none) because all columns fit comfortably in standard horizontal layout. - Lines 123–128: The button features
aria-expanded="false"andaria-controls="details-101", establishing an explicit relationship for screen reader software between the trigger and the collapsible detail drawer. - Lines 135–150: The detail row uses
<td colspan="7">spanning the entire width of the table. Inside, a CSS Grid.detail-containercleanly arranges key-value cards.
Expected Browser Render Output
- Mobile Viewport (375px): Shows only
[▶],Order ID,Customer, andTotal. Tapping the[▶]flips the icon to[▼]and slides open a grey drawer displayingProduct Tier,Date Placed, andPayment Method. - Tablet Viewport (768px): Automatically reveals
Product Tierin the main table row. - Desktop Viewport (1200px): The
[▶]expand button disappears entirely; all 6 data columns are cleanly visible in a single horizontal row.
🏋️ Hands-On Exercise
🎯 The Challenge: Add Priority Column Tiers to a Server Health Table
Instructions:
- Assign priority classes to the table columns:
Server Name&Status: Priority 1 (Always visible).CPU Usage&Memory: Priority 2 (Visible $\ge 600\text{px}$).Disk IOPS&Uptime: Priority 3 (Visible $\ge 900\text{px}$).
- Add the corresponding CSS classes and media queries so the table degrades cleanly without horizontal overflow.
🏁 Starter Code Sandbox
⚠️ Common Pitfalls
- Applying priority classes to
<td>but forgetting<th>: If you hide a<td>in<tbody>without hiding the corresponding<th>in<thead>, the header row will have more columns than the data rows, shifting all cell data out of alignment! - Neglecting
colspanon expanded drawer cells: When inserting a detail drawer<tr class="detail-row">, always set<td colspan="...">equal to the maximum possible number of columns, otherwise the drawer will only fill the first column width.
💡 Pro Tips
- Allow User Column Customization: Implement a user-facing "Column Picker" dropdown (
<dialog>or popover) that lets power users override automatic priority rules and customize visible columns in their profile settings. - Accessible Live Regions for Expandable Content: If drawer rows contain dynamic or asynchronously fetched data, add
aria-live="polite"to the container so screen readers notify users when content finishes loading.
📌 Key Takeaways
- Priority column hiding uses responsive breakpoints to show critical data on mobile and progressive details on larger displays.
- Priority classes must be applied symmetrically to both
<th>headers and<td>data cells. - The progressive disclosure drawer pattern ensures mobile users retain full access to suppressed data via interactive accordion rows.
- Interactive triggers require
aria-expandedandaria-controlsto communicate drawer state to assistive software. - --