BEGINNER • HTML and CSS Basics
Sprint: reduce layout shift #7
This lesson focuses on reduce layout shift for a admin data table interface. You will use: npm create vite@latest my-app | npm run build | element.addEventListener('click', handler). The content is designed for practical frontend development.
Code Example
// Accessible component
<button
aria-label="Add to cart"
aria-pressed={isInCart}
onClick={handleClick}
>
Add to Cart
</button>
// Objective: reduce layout shiftCommands & References
- npm create vite@latest my-app
- npm run build
- element.addEventListener('click', handler)
Lab Steps
- Set up with: npm create vite@latest my-app
- Build or refactor the component for the scenario.
- Validate accessibility and performance.
- Propose one improvement for production.
Exercises
- Add one accessibility enhancement.
- Implement one performance optimization.
- Write one unit test for this component.