惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
雷峰网
雷峰网
量子位
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
T
Tailwind CSS Blog
月光博客
月光博客
博客园 - 【当耐特】
博客园_首页
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13
Astro 4.1
Erika, Emanuele Stoppa, Matthew Phillips, Nate Moore, Bjorn Lu · 2024-01-04 · via The Astro Blog

After a small break for the holidays, we’re back with a new release of Astro! Astro 4.1 includes a number of bug fixes and improvements. As we’re all getting back into the swing of things, this release is a bit smaller than usual, but we’re all excited to get back to work on Astro and have some exciting things planned for 2024!

Highlights include:

  • New accessibility audit rules
  • New configuration option for client:visible
  • Custom cookie encoding and decoding

To take advantage of the latest features, make sure you’re running the latest version of Astro. You can upgrade to Astro 4.1 by running the @astrojs/upgrade command:

or by running the upgrade command for your package manager:

npm install astro@latest

pnpm upgrade astro --latest

yarn upgrade astro --latest

New accessibility audit rules

We’ve added two new audit rules for the dev toolbar. You will now be warned about:

  • Unsupported ARIA attributes
  • Missing attributes required for ARIA role

Both these rules help ensure that the elements on your page have correct and valid ARIA roles.

Extended client:visible directive

The client:visible directive now accepts a rootMargin option, which allows you to specify a margin around the viewport to calculate visibility. This allows a component to be hydrated when it is close to the viewport instead of waiting for it to become visible.

<!-- Load component when it's within 200px away from entering the viewport -->

<Component client:visible={{rootMargin: "200px"}} />

Cookie encoding/decoding can now be customized through new encode and decode functions when setting and getting cookies.

For example, you can bypass the default encoding via encodeURIComponent when adding a URL as part of a cookie:

---

import { encodeCookieValue } from './cookies';

Astro.cookies.set('url', Astro.url.toString(), {

// Override the default encoding so that URI components are not encoded

encode: (value) => encodeCookieValue(value),

});

---

Later, you can decode the URL in the same way:

---

import { decodeCookieValue } from './cookies';

const url = Astro.cookies.get('url', {

decode: (value) => decodeCookieValue(value),

});

---

Bug Fixes

Additional bug fixes are included in this release. Check out the release notes to learn more.