فهرس الصفحة المتتبّع Scrollspy (On This Page)
قائمة «في هذه الصفحة» على الجانب، يتغيّر العنوان المميّز فيها حسب القسم الذي تقرؤه.
يُعرف أيضاً باسم: On This Page
IntersectionObserver + aria-currentمتى تستخدمه
في صفحات التوثيق والمقالات الطويلة.
خطأ شائع
لا لزوم له في صفحة لا تحوي سوى قسمين.
إمكانية الوصول
Keep the links real anchors so they work without JavaScript.
اسمه في الكود
| HTML/CSS | IntersectionObserver + aria-current |
|---|---|
| React | useActiveHeading (custom) |
| Jetpack Compose | LazyListState.firstVisibleItemIndex |
| SwiftUI | ScrollPosition (custom) |
برومبت جاهز لوكيل البرمجة
Add a Scrollspy (On This Page) to this screen.
What it is: An On-this-page list whose highlighted link follows the section you’re reading.
Implement with: IntersectionObserver + aria-current (HTML/CSS).
Accessibility: Keep the links real anchors so they work without JavaScript.
When to use it: On documentation and long articles.
Avoid: Pointless on a page with two sections.
Reuse the project's existing design tokens, spacing and component conventions.
أو ركّب صفحة كاملة من هذا العنصر وغيره →
البرومبت بالإنجليزية لأنها الأدق مع Claude Code وأمثاله.