Skip to content

feat(ui): animate collapse panels in the new UI#15116

Open
ksitton58 wants to merge 1 commit into
DefectDojo:devfrom
ksitton58:feat/new-ui-smooth-collapse-panels
Open

feat(ui): animate collapse panels in the new UI#15116
ksitton58 wants to merge 1 commit into
DefectDojo:devfrom
ksitton58:feat/new-ui-smooth-collapse-panels

Conversation

@ksitton58

Copy link
Copy Markdown
Contributor

Description

Collapse panels in the new UI (finding-detail sections like Description / Mitigation / Impact, and other data-toggle="collapse" panels) toggled open and closed instantly with no animation, which felt abrupt. This adds a smooth height slide, consistent with the filter accordion.

Changes:

  • index.js: the shared collapse shim now animates the target's height and vertical padding between 0 and its natural size over 250ms, then settles to auto (open) or display:none via .in (closed). It respects prefers-reduced-motion (instant toggle), preserves aria-expanded, guards against re-clicks mid-animation, and handles both border-box and content-box. One change covers every collapse panel in the new UI, with no per-panel template changes.
  • base.html: cache-bust index.js with ?v={% static_v %} (matching how the CSS is loaded) so this JS change actually reaches users' browsers. First-party JS was not versioned before.

No Bootstrap is reintroduced. This enhances the new UI's own vanilla-JS shim that already replaced Bootstrap's collapse.

Test results

Verified on a local build (finding detail page): clicking a section animates its height smoothly from 0 to full and back (sampled per frame: steady 0 to 56px on open, 56 to 0px on close, no stall or jump), aria-expanded toggles correctly, and the form is not submitted. No Python changed, so no unit tests added.

Documentation

N/A.

Checklist

  • Submitted against dev.
  • Meaningful PR name.
  • Ruff compliant (no Python changed).
  • Python 3.13 compliant (no Python changed).

Collapse panels in the new UI (finding-detail sections and other
data-toggle="collapse" panels) toggled open/closed instantly. Add a smooth
height slide, consistent with the filter accordion.

- index.js: the shared collapse shim now animates the target height and
  vertical padding between 0 and its natural size over 250ms, settling to auto
  (open) or display:none via .in (closed). Respects prefers-reduced-motion
  (instant toggle), preserves aria-expanded, guards against re-clicks
  mid-animation, and handles both border-box and content-box. One change covers
  every collapse panel in the new UI.
- base.html: cache-bust index.js with ?v={% static_v %} (matching how the CSS is
  loaded) so the JS change reaches users; first-party JS was not versioned before.

No Bootstrap is reintroduced: this enhances the new UI vanilla-JS shim that
already replaced Bootstrap collapse.

@mtesauro mtesauro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved

@Maffooch Maffooch added this to the 3.1.0 milestone Jul 1, 2026

@valentijnscholten valentijnscholten left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I usually like fast and no animations, but I guess I'm not your default user. Approved :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants