Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-68986] Remove link element from breadcrumb items without href #6837

Merged
merged 7 commits into from Jul 18, 2022

Conversation

janfaracik
Copy link
Contributor

@janfaracik janfaracik commented Jul 11, 2022

See JENKINS-68986.

Fairly straightforward PR to remove link elements from breadcrumb items without href set, as seen in 68986 - thanks @daniel-beck.

To make the breadcrumb bar experience more consistent, I've removed the custom breadcrumb implementation from lines 45 - 57 in favour of using the breadcrumb.jelly component. This means that we only have to include logic/customisation in one place. If anyone has any issues with this implementation/finds bugs do let me know.

Before - notice the hover state
Screenshot 2022-07-12 at 00 43 55

After - notice the lack of hover state/inability to click the breadcrumb item
image

Proposed changelog entries

  • Do not include links on bread crumb elements that do not define a hyperlink destination.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO") if applicable.
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@jenkinsci/sig-ux @daniel-beck

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@NotMyFault NotMyFault requested a review from a team July 12, 2022 10:59
@NotMyFault NotMyFault added web-ui The PR includes WebUI changes which may need special expertise bug For changelog: Minor bug. Will be listed after features needs-security-review Awaiting review by a security team member labels Jul 12, 2022
@daniel-beck daniel-beck added security-approved @jenkinsci/core-security-review reviewed this PR for security issues and removed needs-security-review Awaiting review by a security team member labels Jul 12, 2022
daniel-beck
daniel-beck previously approved these changes Jul 13, 2022
core/src/main/resources/lib/layout/breadcrumb.jelly Outdated Show resolved Hide resolved
@daniel-beck
Copy link
Member

wrong

I thought my approval was premature and I had discovered a problem, but that was incorrect.

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Works for the manual ones at least.

There's a number of other ones that could have their links removed, like the CLI (e.g. /manage/cli/)

@timja timja added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jul 14, 2022
@timja
Copy link
Member

timja commented Jul 14, 2022

This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@daniel-beck
Copy link
Member

There's a number of other ones that could have their links removed, like the CLI (e.g. /manage/cli/)

I just re-ran the PR build and the "Jenkins CLI" crumb works.

Every automatic crumb has a URL (by convention, ModelObject doesn't have #getUrl) so wouldn't lose the link. If there's no anc.url, the (AFAICT, untested) behavior of linking to / remains unchanged.

@timja
Copy link
Member

timja commented Jul 14, 2022

linking to / remains unchanged

correct this has no change over the previous behaviour, just something I noticed.

Every automatic crumb has a URL (by convention, ModelObject doesn't have #getUrl) so wouldn't lose the link. If there's no anc.url, the (AFAICT, untested) behavior of linking to / remains unchanged.

What I mean is you can click the CLI crumb currently, in this PR it removes the link state etc around the crumbs for the ones without links.

There's no reason to have a link on the active crumb so that could be removed (and likely should be emphasized to make it look different as the active crumb too).

@daniel-beck
Copy link
Member

What I mean is you can click the CLI crumb currently, in this PR it removes the link state etc around the crumbs for the ones without links.

Not for me. Could you provide screenshots of what specifically you're referring to?

Comment on lines +47 to +56
<j:choose>
<j:when test="${attrs.href == null}">
${attrs.title}
</j:when>
<j:otherwise>
<a href="${attrs.href}" class="${attrs.hasMenu ? 'model-link' : ''}">
${attrs.title}
</a>
</j:otherwise>
</j:choose>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we wanted to remove the link for the current page, we could do something like -

<j:choose>
        <j:set var="isCurrent" value="${h.hyperlinkMatchesCurrentPage(attrs.href)}" />
        <j:when test="${attrs.href == null or isCurrent}">
          ${attrs.title}
        </j:when>
        <j:otherwise>
          <a href="${attrs.href}" class="${attrs.hasMenu ? 'model-link' : ''}">
            ${attrs.title}
          </a>
        </j:otherwise>
      </j:choose>

Copy link
Member

Choose a reason for hiding this comment

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

I think that would make sense for consistency. (also I think it would be good to show the difference between non linked breadcrumbs and linked ones maybe an underline)

@timja
Copy link
Member

timja commented Jul 14, 2022

What I mean is you can click the CLI crumb currently, in this PR it removes the link state etc around the crumbs for the ones without links.

Not for me. Could you provide screenshots of what specifically you're referring to?

Links to current page:
image

No link:
image

@daniel-beck
Copy link
Member

@timja I see, I misunderstood your comment to mean this PR already changes things, when it doesn't, but could.

Better off in a separate PR, but probably useful.

FWIW /configure vs. /configureTools is a fairly good example demonstrating the problem from a user POV.

@timja timja merged commit 536ee99 into jenkinsci:master Jul 18, 2022
@timja timja deleted the update-breadcrumbs branch July 18, 2022 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback security-approved @jenkinsci/core-security-review reviewed this PR for security issues web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
4 participants