Pinterest has replaced its legacy JavaScript-based carousel system with native CSS implementations, reducing code complexity and improving performance. This was recently highlighted by Google on their ‘Chrome for Developers’ account on X.
The change moves a core UI component—used widely across feeds, search, and shopping experiences—from a heavily customised JavaScript setup to browser-native CSS primitives such as scroll snapping and markers.
The earlier system had evolved over time into a complex codebase spanning nearly 2,000 lines of JavaScript, built and modified by multiple teams.
Engineers said this made the component difficult to maintain and introduced performance issues, including noticeable lag during interactions. “You feel the jank in every scroll,” said Calvin Chhour, senior software engineer at Pinterest, in a YouTube video.
Pinterest engineers said an initial prototype of the CSS-based carousel was built quickly and showed immediate improvements in smoothness, as UI interactions were no longer blocked on the browser’s main thread.
By rebuilding the carousel using CSS, Pinterest reduced the implementation to around 200 lines of code, a 90% drop. “We were able to reduce 2,000 lines of JavaScript to 200 lines of CSS,” Chhour said.
The company tested the new implementation through A/B experiments, running a portion of users on the new experience while others remained on the older system. According to Pinterest, the updated approach delivered measurable improvements in both performance and user experience.
“We also saw 15% improvements in just page load time in general,” Anuja Shah, an engineering manager at Pinterest, said in the video. The company subsequently rolled out the new carousel to its full user base.
Pinterest engineers said the shift to CSS also enables smoother interactions and opens up new possibilities for animations and transitions using native browser capabilities, without relying on heavier JavaScript libraries.
The company added that it has since extended the CSS-based carousel across multiple product surfaces, working with teams across the home feed, search, shopping, and boards to replace existing implementations.
- AI Productivity to Add $28 Billion to $84 Billion to India's GDP: Cognizant Study
- OpenAI's Codex Helps in Aerodynamic Engineering for Mazda
- Bengaluru Accounts for 34% of India's FDE Talent: Report
- 84% See AI Productivity Gains, but Only 10% Allow Agent Autonomy: TCS Study
- Snowflake Introduces Business Ontology, Cortex AI Gateway to Bring AI Agents Into Enterprise Workflows
- Three Members Behind Claude Code Leave Anthropic Within 10 Days

