A bar chart showing quarterly sales data. Q1: $100k, Q2: $120k, Q3: $150k.
The chart shows a steady increase in sales throughout the year.
// Complex images
Our company has grown from 10 employees in 2020 to 100 employees in 2024,
with revenue increasing from $1M to $10M over the same period.
# 8. Keyboard Navigation
// Custom keyboard navigation
class KeyboardNavigation {
constructor(container) {
this.container = container;
this.focusableElements = container.querySelectorAll(
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
);
this.currentIndex = 0;
}
init() {
this.container.addEventListener('keydown', this.handleKeyDown.bind(this));
}
handleKeyDown(event) {
switch (event.key) {
case 'ArrowDown':
case 'ArrowRight':
event.preventDefault();
this.focusNext();
break;
case 'ArrowUp':
case 'ArrowLeft':
event.preventDefault();
this.focusPrevious();
break;
case 'Home':
event.preventDefault();
this.focusFirst();
break;
case 'End':
event.preventDefault();
this.focusLast();
break;
}
}
focusNext() {
this.currentIndex = (this.currentIndex + 1) % this.focusableElements.length;
this.focusableElements[this.currentIndex].focus();
}
focusPrevious() {
this.currentIndex = this.currentIndex === 0
? this.focusableElements.length - 1
: this.currentIndex - 1;
this.focusableElements[this.currentIndex].focus();
}
focusFirst() {
this.currentIndex = 0;
this.focusableElements[0].focus();
}
focusLast() {
this.currentIndex = this.focusableElements.length - 1;
this.focusableElements[this.currentIndex].focus();
}
}
# 9. Live Regions
// Announce dynamic content changes
function updateStatus(message) {
const statusElement = document.getElementById('status');
statusElement.textContent = message;
}
// Use assertive for urgent updates
function showAlert(message) {
const alertElement = document.getElementById('alert');
alertElement.textContent = message;
}
# 10. Accessibility Testing
// Automated accessibility testing
const axe = require('axe-core');
function runAccessibilityTests() {
axe.run(document, (err, results) => {
if (err) throw err;
console.log('Accessibility violations:', results.violations);
results.violations.forEach(violation => {
console.log(`Rule: ${violation.id}`);
console.log(`Description: ${violation.description}`);
console.log(`Impact: ${violation.impact}`);
console.log(`Nodes: ${violation.nodes.length}`);
});
});
}
// Manual testing checklist
const accessibilityChecklist = {
keyboard: [
'All interactive elements are keyboard accessible',
'Tab order is logical and intuitive',
'Focus indicators are visible',
'No keyboard traps'
],
screenReader: [
'All content is accessible to screen readers',
'Images have appropriate alt text',
'Form labels are properly associated',
'Headings are properly structured'
],
visual: [
'Color contrast meets WCAG standards',
'Content is readable without color',
'Text can be resized up to 200%',
'No content flashes more than 3 times per second'
]
};
SEO Optimization
SEO Best Practices
Lighthouse Categories
Performance
Accessibility
Best Practices
SEO
Progressive Web App
Optimization Areas
Core Web Vitals
Image optimization
Code splitting
Resource hints
Caching strategies
Semantic HTML
ARIA attributes
Summary
Lighthouse score improvement involves several key areas:
Performance: Core Web Vitals, image optimization, and code splitting
Accessibility: Semantic HTML, ARIA attributes, and keyboard navigation
SEO: Meta tags, structured data, and content optimization
Best Practices: Security headers, HTTPS, and modern web standards
Need More Help?
Struggling with Lighthouse scores or need help optimizing your website performance? Our frontend experts can help you achieve better scores and improve user experience.