Skip to content

Restore "clamper" functionality for e.g. subjects, without using jQuery#11872

Merged
cdrini merged 4 commits intointernetarchive:masterfrom
agmckee:fix-clampers-category-list-without-jquery
Feb 19, 2026
Merged

Restore "clamper" functionality for e.g. subjects, without using jQuery#11872
cdrini merged 4 commits intointernetarchive:masterfrom
agmckee:fix-clampers-category-list-without-jquery

Conversation

@agmckee
Copy link
Contributor

@agmckee agmckee commented Feb 14, 2026

Closes #11866

Fixes the "clamper" functionality that was inadvertently removed in #11682 by adding an event handler for click events on elements with the class "clamp".

Technical

Based on the approach taken by @lokesh in #11870 but without using jQuery. Uses plain JS properties and methods which are widely supported.

Testing

Build the JS and go to any work page and verify that collapsed category list is expandable.

Screenshot

Screencast.From.2026-02-14.19-24-29.mp4

Stakeholders

@cdrini

@github-actions github-actions bot added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Feb 14, 2026
@lokesh lokesh requested a review from cdrini February 15, 2026 02:30
@lokesh
Copy link
Collaborator

lokesh commented Feb 15, 2026

@agmckee could you add another video showing the behavior working after the changes. Code looks good otherwise!

Behaviors to check:

  1. Clicking the header ("Subjects") to toggle.
  2. Only showing the arrow when items exceed one row

@agmckee
Copy link
Contributor Author

agmckee commented Feb 15, 2026

As requested:

Screencast.From.2026-02-15.17-54-23.mp4

Checked:

Only showing the arrow when items exceed one row. ✓
Clicking the header ("Subjects") to toggle. ✓

Also:

Clicking the right-pointing triangle (▸) character to toggle ✓
Clicking the ellipsis character to toggle ✓
Links to subjects continue to work normally (clickable to visit subject page) ✓

@tfmorris
Copy link
Contributor

It's hard to tell from the video, but it doesn't look like the triangle's state is correctly tracking the state of the list. Perhaps it's only updating when clicked directly on, but not when the word "Subjects" or the ellipses are clicked?

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Feb 16, 2026
@agmckee
Copy link
Contributor Author

agmckee commented Feb 16, 2026

It's hard to tell from the video, but it doesn't look like the triangle's state is correctly tracking the state of the list. Perhaps it's only updating when clicked directly on, but not when the word "Subjects" or the ellipses are clicked?

You're correct, it wasn't updating the UI properly. I've found and fixed the issue, and was able to further simplify the code while resolving that issue.
New recording:

Screencast.From.2026-02-16.12-35-17.mp4

@agmckee agmckee requested a review from lokesh February 16, 2026 14:01
Copy link
Collaborator

@lokesh lokesh left a comment

Choose a reason for hiding this comment

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

LGTM. Tested locally and everything works as expected. Thanks @agmckee


Not blocking, but for new features that are used across multiple files and depend on an html hook, we should avoid the hook being a simple css classname as this is brittle as markup shifts and devs assume the class is for styling exclusively. An alternative is using a data attribute, a couple of example approaches: data-behavior="clamp" or data-ol-enhance="clamp". Mostly though, I expect us to use web components for this scenarios, and this will be non issue.

@cdrini cdrini merged commit 954835e into internetarchive:master Feb 19, 2026
4 checks passed
@agmckee agmckee deleted the fix-clampers-category-list-without-jquery branch February 20, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead Priority: 1 Do this week, receiving emails, time sensitive, . [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapsed list of subjects cannot be expanded

4 participants