[JENKINS-75851] fix inpage nav

Signed-off-by: Thorsten Scherler <scherler@gmail.com>
This commit is contained in:
Thorsten Scherler 2025-07-28 14:22:07 +02:00
parent 2eca9ac9f0
commit ed52afb5af
No known key found for this signature in database
GPG Key ID: A6A63ACEC37EDBBA
3 changed files with 12 additions and 8 deletions

View File

@ -50,11 +50,15 @@ THE SOFTWARE.
<j:set var="baseUrl" value="${request2.originalRequestURI}" /> <j:set var="baseUrl" value="${request2.originalRequestURI}" />
<j:set var="hasLink" value="${attrs.href != null}" /> <j:set var="hasLink" value="${attrs.href != null}" />
<j:set var="isCurrent" value="${baseUrl == attrs.href}" /> <j:set var="isCurrent" value="${baseUrl == attrs.href}" />
<j:set var="isSystem" value="${baseUrl.contains('manage/configure')}" />
<j:set var="shouldShowTitle" value="${attrs.title.length() > 26}" /> <j:set var="shouldShowTitle" value="${attrs.title.length() > 26}" />
<li aria-current="${(isCurrent or !hasLink)? 'page' : null}" id="${attrs.id}" class="jenkins-breadcrumbs__list-item" data-type="breadcrumb-item"> <li aria-current="${(isCurrent or !hasLink)? 'page' : null}"
id="${attrs.id}" class="jenkins-breadcrumbs__list-item"
data-type="breadcrumb-item" data-has-menu="${attrs.hasMenu}"
>
<j:choose> <j:choose>
<j:when test="${!hasLink or isCurrent}"> <j:when test="${(!hasLink and !attrs.hasMenu) or (isCurrent and !isSystem)}">
<j:choose> <j:choose>
<j:when test="${shouldShowTitle}"> <j:when test="${shouldShowTitle}">
<span tooltip="${attrs.title}">${attrs.title}</span> <span tooltip="${attrs.title}">${attrs.title}</span>
@ -67,18 +71,18 @@ THE SOFTWARE.
<j:otherwise> <j:otherwise>
<j:choose> <j:choose>
<j:when test="${shouldShowTitle}"> <j:when test="${shouldShowTitle}">
<a tooltip="${attrs.title}" href="${attrs.href}"> <a aria-label="path element" tooltip="${attrs.title}" href="${attrs.href}">
${attrs.title} ${attrs.title}
</a> </a>
</j:when> </j:when>
<j:otherwise> <j:otherwise>
<a href="${attrs.href}"> <a aria-label="path element" href="${attrs.href}">
${attrs.title} ${attrs.title}
</a> </a>
</j:otherwise> </j:otherwise>
</j:choose> </j:choose>
<j:if test="${attrs.hasMenu or attrs.hasChildrenMenu}"> <j:if test="${attrs.hasMenu or attrs.hasChildrenMenu}">
<div data-iscurrent="${isCurrent}" data-href="${attrs.href}" data-base="${baseUrl}" tabindex="0" class="dropdown-indicator" data-model="${attrs.hasMenu}" data-children="${attrs.hasChildrenMenu}" > <div aria-label="dropdown menu for path" data-iscurrent="${isCurrent}" data-href="${attrs.href}" data-base="${baseUrl}" tabindex="0" class="dropdown-indicator" data-model="${attrs.hasMenu}" data-children="${attrs.hasChildrenMenu}" >
<l:icon class="icon-sm jenkins-!-text-color-secondary" src="symbol-chevron-down" /> <l:icon class="icon-sm jenkins-!-text-color-secondary" src="symbol-chevron-down" />
</div> </div>
</j:if> </j:if>

View File

@ -5,7 +5,7 @@ import { toId } from "@/util/dom";
* sections on the page (if using <f:breadcrumb-config-outline />) * sections on the page (if using <f:breadcrumb-config-outline />)
*/ */
function init() { function init() {
const inpageNavigationBreadcrumb = document.querySelector("#inpage-nav span"); const inpageNavigationBreadcrumb = document.querySelector("#inpage-nav div");
if (inpageNavigationBreadcrumb) { if (inpageNavigationBreadcrumb) {
inpageNavigationBreadcrumb.items = Array.from( inpageNavigationBreadcrumb.items = Array.from(

View File

@ -45,7 +45,7 @@ function generateDropdowns() {
element.classList.contains("hoverable-children-model-link"), element.classList.contains("hoverable-children-model-link"),
element.href, element.href,
), ),
false, element.items != null,
{ {
trigger: "mouseenter", trigger: "mouseenter",
offset: [-16, 10], offset: [-16, 10],
@ -68,7 +68,7 @@ function generateDropdowns() {
element.getAttribute("data-children"), element.getAttribute("data-children"),
element.getAttribute("data-href"), element.getAttribute("data-href"),
), ),
false, element.items != null,
{ {
trigger: "click focus", trigger: "click focus",
offset: [-16, 10], offset: [-16, 10],