Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions eyebrow.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
/*
* Hide the page eyebrow when it repeats the page title.
* Show the parent group in the page eyebrow when the eyebrow repeats the title.
*
* Mintlify shows the sidebar group name above every page title. On a section's
* overview page the title is the section name, so the eyebrow would repeat it.
* On those pages, show the next group up from the sidebar instead ("Configure"
* above "Proxies", "How it works" above "Configure"). The name goes in a
* data attribute that style.css renders, so React keeps owning the text node.
* If there is no parent group to show, hide the eyebrow.
* Mintlify loads every .js file in this directory on every docs page and
* navigates client-side, so re-check whenever the header changes.
*/
(function () {
function parentGroup() {
var item = document.querySelector(
'#navigation-items li[data-active-nav-item="true"]'
);
if (!item) return null;
var groups = [];
for (var el = item.parentElement; el; el = el.parentElement) {
if (el.matches("li[data-group-tag]")) groups.push(el);
}
// groups[0] is the page's own group, the one the eyebrow names.
if (groups.length > 1) return groups[1].getAttribute("data-title");
if (!groups.length) return null;
var section = groups[0].parentElement.previousElementSibling;
var heading =
section &&
section.classList.contains("sidebar-group-header") &&
section.querySelector(".sidebar-title");
return heading ? heading.textContent.trim() : null;
}

function sync() {
var header = document.getElementById("header");
if (!header) return;
Expand All @@ -16,7 +40,13 @@
var same =
eyebrow.textContent.trim().toLowerCase() ===
title.textContent.trim().toLowerCase();
eyebrow.style.display = same ? "none" : "";
var parent = same ? parentGroup() : null;
if (parent) {
eyebrow.setAttribute("data-parent-group", parent);
} else {
eyebrow.removeAttribute("data-parent-group");
}
eyebrow.style.display = same && !parent ? "none" : "";
}

var scheduled = false;
Expand Down
10 changes: 10 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ html.dark #navigation-items img[src*="/images/integration-icons/"] {
display: none;
}

/* eyebrow.js sets data-parent-group on section overview pages, where the
eyebrow would repeat the title; show the parent group's name instead. */
#header .eyebrow[data-parent-group] {
font-size: 0;
}
#header .eyebrow[data-parent-group]::after {
content: attr(data-parent-group);
font-size: 0.875rem;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eyebrow replacement skips assistive tech

Low Severity

The parent group is painted with ::after and font-size: 0, so the original eyebrow text stays in the accessibility tree. Assistive tech still hears the repeating title, and may also hear the parent, which undoes the old display: none hide for those users.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4296869. Configure here.


/* cookbooks card category label — matches the site eyebrow/type setup in the reference */
.cookbook-tag {
display: block;
Expand Down
Loading