Skip to content

Conversation

@rfultz
Copy link
Contributor

@rfultz rfultz commented Apr 11, 2025

Summary

  • Resolves # (if we set this to 6410, will this one PR close that whole ticket? It'll have other PRs, too.)

Resolving the jQuery deprecations has been a burden so let's break #6411 into much smaller pieces

Required reviewers

  • front-end for code
  • anyone for functionality

Impacted areas of the application

General components of the application that this PR will affect:

.bind(), :first, .hover(), .keyCode, :last, .submit(), and .trim() on/in:

  • Audits datatable
  • Calendar
  • Date filter
  • Dropdowns
  • Election map
  • Helpers, getCookie? (I don't see where it's being used anywhere)
  • Maps
  • Search
  • Skip nav
  • Typeahead filter

Screenshots

No changes

Related PRs

Related PRs against other branches:

PR Branch Deprecated features
#6750 feature/jquery-deprecation-click .click
#6751 feature/jquery-deprecation-change .change
#6753 feature/jquery-migrations-focus-blur .focus, .blur
#6752 feature/jquery-deprecations .bind, :first, .hover, .keyCode, :last, .submit, .trim

‡you are here

How to test

  • Pull the branch
  • npm i
  • npm run test-single should be clear
  • npm run build
  • ./manage.py runserver
  • Checking the .bind() change:
    • Go to Audit search/datatables
    • Change the findings and issue categories filters a few times
    • The subcategory filters should update accordingly
  • Checking the :first changes:
    • Go to a page with "dropdowns" (Candidates does. Not native <select> elements, but our dropdown selectors)
    • Click the down arrow to open it
    • The first element should be focused (tabbing should jump to the second one, then shift-tab will move back to the first)
  • Checking the .hover() change:
    • Go to PAC and party committee reports
    • Expand the Dates filter panel
    • Under Transaction period time, click into the Beginning date field
    • Testing the date grid,
    • Select and re-select Beginning and Ending dates
    • The mouseenter and mouseleave actions work as expected
  • Checking the .keyCode changes:
    • Go to the Calendar
    • Tab to any of the dropdowns (Subscribe, Download, any of the events' dropdowns)
    • The Enter key should open the dropdown (we're testing that it reads that it's the Enter key)
    • The Esc key should close the same dropdown (we're testing that it reads that it's the Esc key)
    • Re-load any page
    • Press the tab key to highlight the skip-nav element
    • Press Enter
    • The focus moved to the first element on the page that follows the site header nav
    • ISSUE: I can't find where to test the / key for inside search.js. Are we still using .js-search anywhere? (Move from jQuery .focus, .blur #6753 had the same issue)
  • Checking the :last changes:
    • Go to a Senate election race ([MD, 2028] works)
    • Scroll to "Individual contributions to candidates"
    • Click "Contributor state"
    • Toggle to the map view (instead of table)
    • The map should appear, with states of various colors
  • Checking the .submit() changes:
    • Go to any legal search page with a Keyword search (AOs, fines, etc)
    • Open a Keyword search to get the modal
    • Enter any keyword
    • Click the Search button in the modal
    • The left-panel filters submitted and the page/results updated
    • Go to any page with a site search Typeahead (homepage, /search, etc)
    • Type something into the Typeahead lookup (3+ letters)
    • Click/choose the "Search other pages:" option near the bottom
    • The form submitted and results were shown
  • Checking the .trim() change:
    • I don't know how to test this—I don't think we're using getCookie anywhere
  • Celebrate!

@rfultz rfultz self-assigned this Apr 11, 2025
@rfultz rfultz added this to the 28.1 milestone Apr 11, 2025
@rfultz rfultz changed the title Feature/jquery deprecations jQuery deprecations (bind, first, hover, last, trim, unique) Apr 11, 2025
@rfultz rfultz mentioned this pull request Apr 11, 2025
57 tasks
@codecov
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.83%. Comparing base (cfb73e9) to head (e92c57c).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #6752   +/-   ##
========================================
  Coverage    79.83%   79.83%           
========================================
  Files          237      237           
  Lines         5218     5218           
========================================
  Hits          4166     4166           
  Misses        1052     1052           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rfultz rfultz changed the title jQuery deprecations (bind, first, hover, last, trim, unique) jQuery deprecations (bind, first, hover, keyCode, last, trim, unique) Apr 11, 2025
@rfultz rfultz changed the title jQuery deprecations (bind, first, hover, keyCode, last, trim, unique) Migrate jQuery (bind, first, hover, keyCode, last, trim, unique) Apr 11, 2025
@rfultz rfultz mentioned this pull request Apr 10, 2025
6 tasks
@rfultz rfultz changed the title Migrate jQuery (bind, first, hover, keyCode, last, trim, unique) Move from jQuery .bind, :first, .hover, .keyCode, :last, .trim, .unique Apr 11, 2025
@rfultz rfultz changed the title Move from jQuery .bind, :first, .hover, .keyCode, :last, .trim, .unique Move from jQuery .bind, :first, .hover, .keyCode, :last, .trim Apr 11, 2025
@rfultz rfultz moved this to 👀 Ready in Website project Apr 11, 2025
@rfultz rfultz marked this pull request as ready for review April 11, 2025 15:23
@rfultz rfultz changed the title Move from jQuery .bind, :first, .hover, .keyCode, :last, .trim Move from jQuery .bind, :first, .hover, .keyCode, :last, .submit, .trim Apr 11, 2025
@kathycarothers kathycarothers modified the milestones: 28.1, 28.2 Apr 22, 2025
@rfultz rfultz modified the milestones: 28.2, 28.3 May 6, 2025
@JonellaCulmer JonellaCulmer modified the milestones: 28.3, 28.4 May 20, 2025
@rfultz rfultz modified the milestones: 28.4, 28.5 Jun 3, 2025
@JonellaCulmer JonellaCulmer modified the milestones: 28.5, 28.6 Jun 17, 2025
@rfultz rfultz modified the milestones: 28.6, 29.1 Jul 24, 2025
}

if (e.type == 'change') this.form.submit(); // TODO: jQuery deprecation
if (e.type == 'change') this.form.submit();
Copy link
Member

Choose a reason for hiding this comment

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

Should this use .trigger('submit') now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought so when I added the comment!

I'll check when my system is back up, but I think this.form refers to the <form> instead of the $('form'). If this.form is a jQuery element, it should be .trigger('submit'), yes, but not if it's only the <form>. (jQuery moved to .trigger([event]) to avoid collisions with now-standard things like .click(), .change(), .submit()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this.form is the <form> so .submit() is correct because it isn't a jQuery object.

(and my initial // TODO: jQuery deprecation was wrong)

Copy link
Member

@patphongs patphongs left a comment

Choose a reason for hiding this comment

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

@rfultz

  • :first, .hover(), .keyCode, :last, $.trim() looks like they're handled.
  • I saw one more occurrence of submit that needs to be changed, commented on that
  • Lots of occurrences of .bind() left for filter modules, calendar, dropdown, tables, and widgets. Since there's so much of these changes left, do you want to split bind into a separate PR?

@patphongs patphongs modified the milestones: 29.1, 29.3 Aug 14, 2025
@JonellaCulmer JonellaCulmer modified the milestones: 29.3, 29.5 Sep 2, 2025
@rfultz rfultz modified the milestones: 29.5, 29.6 Sep 16, 2025
@patphongs patphongs modified the milestones: 29.6, 30.2 Nov 20, 2025
@rfultz rfultz modified the milestones: 30.2, 30.3 Dec 2, 2025
@patphongs patphongs modified the milestones: 30.3, 30.5 Dec 16, 2025
@rfultz rfultz modified the milestones: 30.5, 30.6 Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 👀 Ready

Development

Successfully merging this pull request may close these issues.

5 participants