The CSS caret-* properties and custom caret accessibility

Sara Soueidan · 2026年11月16日

AI 摘要 AI 生成,可能有误

本文探讨了 CSS 的 caret-* 属性(caret-color、caret-animation 和 caret-shape)以及围绕插入符(caret)的无障碍考量——插入符是可编辑文本和插入符浏览模式中一个经常被忽视的焦点指示器。文章解释了插入符浏览模式如何实现对网页的精确键盘导航,以及 macOS 和 Windows 等操作系统如何为插入符的闪烁、粗细和可见性提供无障碍设置,而浏览器对这些设置的遵循程度并不一致。作者提醒在应用自定义插入符样式时应保持谨慎,因为插入符可能是某些键盘或指针用户所获得的唯一焦点指示器。

What do you usually think about when you think about focus indicators? Probably outlines? Maybe borders and background color changes, too? That’s what I would normally think about.

When we talk about focus indicators, the discussion usually revolves around outlines, borders, and maybe background color changes, because these styles for focus indicators are universal—you can modify these properties on all focusable elements in a similar manner. You may even design one universal outline that would apply to all the focusable elements on a page and call it a day.

But there’s another, more context-specific focus indicator that is not as widely included in the discussion: the caret.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Sara Soueidan

My top picks for Interop 2027

AI 摘要The author shares their ranked picks for Interop 2027, a yearly project aiming to improve cross-browser interoperability of key web platform features, using Firefox's community ranking page. Their top choices—the HTML focusgroup attribute and the ariaNotify() API—reflect their preference for features that improve both accessibility/user experience and developer experience, followed by other picks like heading-related HTML attributes, Interest Invokers, and various CSS properties. The author notes that features cannot be downvoted, only ranked or left unranked, and concludes by linking to blog posts where other web developers shared their own rankings.

CSS to speech: alternative text for CSS-generated content

AI 摘要The article explains how CSS-generated content inserted via ::before and ::after pseudo-elements is included in an element's accessible name computation, and why meaningful CSS images, icons, and unicode characters need descriptive alternative text while decorative ones should be hidden from screen readers. It introduces the CSS Generated Content Module Level 3 syntax that lets authors provide alternative text after a slash in the content property (with empty-string alt text for decorative content), noting that browser support is now very good except for older browsers like Internet Explorer. The author shares testing results across browsers and screen readers such as VoiceOver, observing that CSS images without alt text are excluded from the accessibility tree, images with alt text are announced properly, and there are some quirks like NVDA not announcing Chrome's CSS image alt text and Safari only showing broken CSS image alt text when VoiceOver is enabled.

🎥 New (Video) Podcast: "Navigating the World of Web Accessibility with Sara Soueidan", with Kevin Powell

AI 摘要The author and Kevin Powell finally recorded a nearly two-hour video podcast about navigating the world of web accessibility, covering topics like HTML semantics, ARIA, screen readers, the accessibility tree, how CSS affects accessibility, and the author's Practical Accessibility course. They also chatted about shared personal interests such as cooking, fermentation, and nutrition. The author invites front-end designers and developers curious about accessibility to watch or listen and share their feedback.

CSS-only scrollspy effect using scroll-marker-group and :target-current

AI 摘要The article explains how to create a CSS-only scrollspy effect using the new scroll-target-group property combined with the :target-current pseudo-class, which automatically highlights navigation links (like a table of contents) when their target sections are scrolled into view—no JavaScript required. It describes how applying scroll-target-group to a container of HTML anchors promotes them to scroll markers, letting the browser determine and style the active link. The author also covers accessibility considerations, including WCAG contrast requirements for active link styling and using aria-current to convey the active state to screen reader users.

Are 'CSS Carousels' accessible?

AI 摘要The article critically examines the accessibility of the newly announced 'CSS Carousels,' a set of CSS-only scrolling UI patterns built with new pseudo-elements like ::scroll-marker and ::scroll-button defined in the CSS Overflow Module 5 specification. Despite claims that carousel accessibility best practices are handled by the browser, the author's inspection of examples reveals significant accessibility and usability concerns, largely because these interactive pseudo-elements are not real DOM elements and the features are still experimental (currently only available in Chrome Canary behind a flag). The post aims to raise accessibility awareness so developers do not adopt these features prematurely and create confusing experiences for assistive technology users.