We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7aeacc9 commit 793d22fCopy full SHA for 793d22f
1 file changed
docs/static/main.js
@@ -102,6 +102,21 @@ document.addEventListener('DOMContentLoaded', () => {
102
}
103
104
});
105
+
106
+ // Highlight the current sidebar link.
107
+ const sb = document.querySelector('aside[data-sidebar]');
108
+ if (sb) {
109
+ const p = location.pathname.replace(/\/$/, '');
110
111
+ // First, try selecting the URL with the hash ID, then the direct URL, then the /components section.
112
+ const a = (location.hash && sb.querySelector(`a[href="${p}/${location.hash}"], a[href="${p}${location.hash}"]`))
113
+ || sb.querySelector(`a[href="${p}/"], a[href="${p}"]`)
114
+ || sb.querySelector(`a[href="/components/#${p.split('/').filter(Boolean).pop()}"]`);
115
116
+ if (a) {
117
+ a.setAttribute('aria-current', 'page');
118
+ }
119
120
121
122
0 commit comments