Skip to content

Fix description editor initially empty#26795

Open
annplatoworld wants to merge 2 commits into
jenkinsci:masterfrom
annplatoworld:fix-26665-empty-description-editor
Open

Fix description editor initially empty#26795
annplatoworld wants to merge 2 commits into
jenkinsci:masterfrom
annplatoworld:fix-26665-empty-description-editor

Conversation

@annplatoworld
Copy link
Copy Markdown

@annplatoworld annplatoworld commented May 16, 2026

Fixes #26665

This is a regression introduced by previous changes most likely #26535, which moved description editing into a modal dialog. CodeMirror cannot compute its layout while its container is hidden (display: none on a <dialog> before showModal()), so the editor rendered empty until the window was resized and CodeMirror's resize handler kicked in.

Initial fix

Calling refresh() on each CodeMirror instance inside the dialog right after showModal() forces it to recalculate immediately.

Updated fix

Use setTimeout to delay behavior setup until after the dialog is shown, so CodeMirror can initialize with the correct dimensions. This avoids coupling the generic Dialog component to CodeMirror.
Thanks @timja for the suggestion.

Testing done

Manually reproduced and verified the fix in a local development instance

  1. Created a freestyle job.
  2. Set its description with the Safe HTML formatter and saved.
  3. Refreshed the page and clicked "Edit description".

Before the change: the editor opened empty; content only appeared after resizing the window.
After the change: the editor opens with the existing description rendered correctly.

Screenshots

Before

image

After

image

Proposed changelog entries

  • Fix description editor rendering empty when reopened inside a modal dialog.

Proposed changelog category

/label regression-fix,web-ui

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.

  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.

  • There is automated testing or an explanation as to why this change has no tests.

  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.

  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.

  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).

  • For dependency updates, there are links to external changelogs and, if possible, full differentials.

  • For new APIs and extension points, there is a link to at least one consumer.

    Desired reviewers

    @zbynek, @timja

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

Maintainer checklist

  • There are at least two (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 is not blocking the change.
  • Changelog entries in the pull request 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, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

Copilot AI review requested due to automatic review settings May 16, 2026 21:13
@comment-ops-bot comment-ops-bot Bot 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 May 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a web UI regression where CodeMirror-backed description editors render empty when first opened inside a <dialog> (hidden via display: none prior to showModal()), by forcing CodeMirror to recalculate its layout immediately after the dialog becomes visible.

Changes:

  • After calling dialog.showModal(), finds CodeMirror-enhanced <textarea class="codemirror"> elements inside the dialog and calls codemirrorObject.refresh() on each instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/js/components/dialogs/index.js Outdated
@annplatoworld annplatoworld force-pushed the fix-26665-empty-description-editor branch from c689359 to ff04947 Compare May 18, 2026 06:39
@timja timja requested a review from a team May 18, 2026 07:01
Copilot AI review requested due to automatic review settings May 20, 2026 05:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

Description editor initially empty

3 participants