Skip to content

Forum stats headers render escaped HTML when sorting #12697

Description

@not-so-shubh

Describe the bug
On the Discussion Forum statistics page, clicking the sortable column headers (User, Total Posts (not deleted), Total Threads, Total Deleted Posts, and Total Upducks) can cause the header labels to render as escaped HTML text (for example, <a href="#">User</a>).

Expected behavior
The stats table headers should remain properly rendered as normal text/sort labels after being clicked. No escaped HTML should appear, and sorting should continue to behave normally.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Discussion Forum statistics page (/forum/stats).
  2. Click any sortable column header:
    • User
    • Total Posts (not deleted)
    • Total Threads
    • Total Deleted Posts
    • Total Upducks
  3. Observe that the header text may change into escaped HTML text such as <a href="#">...</a>.

Configuration

  • OS: macOS
  • Browser: Chrome

Screenshots
A screen recording is attached showing:

  • normal stats table behavior initially
  • escaped HTML appearing in the header labels after clicking a sortable column header
Screen.Recording.2026-03-30.at.21.06.55.mov

Additional context
This appears to be caused by a combination of:

  • invalid table structure in the stats page (e.g., multiple <tbody> elements and missing <thead>)
  • sortable headers implemented using nested <a href="#">...</a> inside <th>
  • JavaScript relying on header HTML (.html()) during sorting

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting TriageBrand New Issue - not yet reviewed & prioritized by the Submitty Project Managersbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions