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-69549] Margins for headers and paragraphs make descriptions … #7078

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

frankie139506
Copy link
Contributor

@frankie139506 frankie139506 commented Sep 7, 2022

See JENKINS-69549.
Before:
image

After:
image

Another example:
image

Proposed changelog entries

  • Reduce spacing in help files

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.
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content-Security-Policy directives (see documentation on jenkins.io).
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention

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).

@daniel-beck
Copy link
Member

With changes like this it would be interesting to know why the original change was done in the first place. Requesting @janfaracik as a reviewer to point out what this change in turn will break ;-)

@janfaracik
Copy link
Contributor

With changes like this it would be interesting to know why the original change was done in the first place. Requesting @janfaracik as a reviewer to point out what this change in turn will break ;-)

The original change was made to make page headers have a margin consistent with the page margin. This causes issues like the above however.

For https://issues.jenkins.io/browse/JENKINS-69549 there's two issues:

  • the titles are using h1 - this should be changed to be correct for the heading level
  • the margin is set incorrectly (as mentioned above)

(I haven't tried this PR yet) but I believe a better fix would be to change the value of --section-padding in the help component class, e.g. half the current value.

@frankie139506
Copy link
Contributor Author

frankie139506 commented Sep 9, 2022

  • the titles are using h1 - this should be changed to be correct for the heading level
    I have changed to h3 for the title.
  • the margin is set incorrectly (as mentioned above)
    I have made some change and I think this change is more reasonable.

@daniel-beck
Copy link
Member

daniel-beck commented Sep 9, 2022

the titles are using h1 - this should be changed to be correct for the heading level

This is impractical to implement across the ecosystem. We need to expect that all levels of h*, p, div, and basic formatting are used freely in help files, and deal with it.

@janfaracik
Copy link
Contributor

janfaracik commented Sep 9, 2022

the titles are using h1 - this should be changed to be correct for the heading level

This is impractical to implement across the ecosystem. We need to expect that all levels of h*, p, div, and basic formatting are used freely in help files, and deal with it.

Would it be possible (and relatively straightforward) to dynamically change the header levels when clicking the❓button?

@daniel-beck
Copy link
Member

Would it be possible (and relatively straightforward) to dynamically change the header levels when clicking the❓button?

We already rewrite the responses some in

// Ensure links open in new window unless explicitly specified otherwise
var links = div.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.hasAttribute("href")) {
// ignore document anchors
if (!link.hasAttribute("target")) {
link.setAttribute("target", "_blank");
}
if (!link.hasAttribute("rel")) {
link.setAttribute("rel", "noopener noreferrer");
}
}
}
layoutUpdateCallback.call();
},
so it should be feasible. Is this preferable to e.g. having styles conditional on h* being inside/output the help block, and if so, why?

@NotMyFault NotMyFault added regression-fix Pull request that fixes a regression in one of the previous Jenkins releases web-ui The PR includes WebUI changes which may need special expertise labels Sep 14, 2022
@NotMyFault NotMyFault requested a review from a team September 14, 2022 20:55
@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Apr 21, 2023
@github-actions
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Oct 15, 2024
@timja timja requested review from janfaracik and NotMyFault and removed request for janfaracik October 15, 2024 21:26
@timja
Copy link
Member

timja commented Oct 15, 2024

the titles are using h1 - this should be changed to be correct for the heading level

This is impractical to implement across the ecosystem. We need to expect that all levels of h*, p, div, and basic formatting are used freely in help files, and deal with it.

I've checked and usage statistics was the only place in the ecosystem using an h1:
https://github.com/search?q=org%3Ajenkinsci+h1+language%3AXML+path%3A%2F.%2Bhelp-.%2B%2F&type=code

So no need to rewrite the response imo.

@@ -389,6 +391,24 @@ pre.console {
p:last-of-type {
Copy link
Member

Choose a reason for hiding this comment

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

I tried removing this as its the cause of the heading spacing issue but I couldn't find a way to make it work whilst keeping no spacing at the bottom of the help file (made worse in help from plugins that have from plugin ... as the space was a bit excessive without this.

// add spacing above headings except for when its the first element in the help
// the need for this is caused by p:last-of-type setting margin-bottom to 0
// unfortunately because of the varied markup I wasn't able to find a way to avoid this
h1:not(:first-child),
Copy link
Member

Choose a reason for hiding this comment

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

@janfaracik what do you think about this approach and can you think of a simpler one?

@@ -8,7 +8,7 @@ def f=namespace(lib.FormTagLib)

f.section(title: _("Usage Statistics")) {
if (UsageStatistics.DISABLED) {
span(class: "jenkins-not-applicable") {
div(class: "jenkins-not-applicable jenkins-!-margin-bottom-2") {
Copy link
Member

Choose a reason for hiding this comment

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

Didn't look great as it was touching the line

Before:
image

After:
image

@@ -38,24 +38,34 @@
Each trial has a specific purpose and a defined end date, after which collection stops, independent of the installed versions of Jenkins or plugins.
Once a trial is complete, the trial results may be aggregated and shared with the developer community.
</p>
<p>
The following trials defined on this instance are active now or in the future:
Copy link
Member

Choose a reason for hiding this comment

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

the help was ending with this as there's no trials currently (and an empty dl)

@timja timja requested review from a team and daniel-beck October 15, 2024 21:32
@janfaracik
Copy link
Contributor

Will take a look 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-fix Pull request that fixes a regression in one of the previous Jenkins releases web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants