diff --git a/fec/fec/static/js/modules/calendar-tooltip.js b/fec/fec/static/js/modules/calendar-tooltip.js index 3b087e968..99afb82cb 100644 --- a/fec/fec/static/js/modules/calendar-tooltip.js +++ b/fec/fec/static/js/modules/calendar-tooltip.js @@ -34,6 +34,6 @@ CalendarTooltip.prototype.close = function() { this.$content.remove(); this.exportDropdown.destroy(); this.$container.removeClass('is-active'); - this.$container.focus(); // TODO: jQuery deprecation + this.$container.trigger('focus'); this.events.clear(); }; diff --git a/fec/fec/static/js/modules/calendar.js b/fec/fec/static/js/modules/calendar.js index bdda2ea1c..07ae30db9 100644 --- a/fec/fec/static/js/modules/calendar.js +++ b/fec/fec/static/js/modules/calendar.js @@ -350,8 +350,8 @@ Calendar.prototype.managePopoverControl = function(e) { $popover .find('.fc-close') .attr('tabindex', '0') - .focus() // TODO: jQuery deprecation + .trigger('focus') .on('click', function() { - $target.focus(); // TODO: jQuery deprecation + $target.trigger('focus'); }); }; diff --git a/fec/fec/static/js/modules/download.js b/fec/fec/static/js/modules/download.js index c130dd422..e0b9d80d2 100644 --- a/fec/fec/static/js/modules/download.js +++ b/fec/fec/static/js/modules/download.js @@ -36,7 +36,7 @@ export function download(url, init, focus) { } if (focus) { - item.$button.focus(); // TODO: jQuery deprecation + item.$button.trigger('focus'); } return item; diff --git a/fec/fec/static/js/modules/dropdowns.js b/fec/fec/static/js/modules/dropdowns.js index 0d1c0762f..7119dc3ec 100644 --- a/fec/fec/static/js/modules/dropdowns.js +++ b/fec/fec/static/js/modules/dropdowns.js @@ -85,7 +85,7 @@ Dropdown.prototype.toggle = function(e) { Dropdown.prototype.show = function() { restoreTabindex(this.$panel); this.$panel.attr('aria-hidden', 'false'); - this.$panel.find('input[type="checkbox"]:first').focus(); // TODO: jQuery deprecation (:first and .focus) + this.$panel.find('input[type="checkbox"]').first().trigger('focus'); this.$button.addClass('is-active'); this.isOpen = true; }; @@ -120,7 +120,7 @@ Dropdown.prototype.handleKeyup = function(e) { if (e.keyCode === KEYCODE_ESC) { if (this.isOpen) { this.hide(); - this.$button.focus(); // TODO: jQuery deprecation + this.$button.trigger('focus'); } } }; @@ -221,14 +221,14 @@ Dropdown.prototype.selectItem = function($input) { if (next.length) { $(next[0]) .find('input[type="checkbox"]') - .focus(); // TODO: jQuery deprecation + .trigger('focus'); } else if (prev.length) { $(prev[0]) .find('input[type="checkbox"]') - .focus(); // TODO: jQuery deprecation + .trigger('focus'); } } else { - this.$selected.find('input[type="checkbox"]').focus(); // TODO: jQuery deprecation + this.$selected.find('input[type="checkbox"]').trigger('focus'); } }; diff --git a/fec/fec/static/js/modules/filters/date-filter.js b/fec/fec/static/js/modules/filters/date-filter.js index 6b3d3163e..14691d429 100644 --- a/fec/fec/static/js/modules/filters/date-filter.js +++ b/fec/fec/static/js/modules/filters/date-filter.js @@ -334,7 +334,7 @@ DateFilter.prototype.handleGridItemSelect = function(e) { this.$grid.find('li').unbind('mouseenter mouseleave'); // TODO: jQuery deprecation (.unbind()) this.setValue(value); this.$grid.addClass('is-invalid'); - $nextItem.focus(); // TODO: jQuery deprecation + $nextItem.trigger('focus'); } }; diff --git a/fec/fec/static/js/modules/filters/filter-panel.js b/fec/fec/static/js/modules/filters/filter-panel.js index afd68691f..38d49f716 100644 --- a/fec/fec/static/js/modules/filters/filter-panel.js +++ b/fec/fec/static/js/modules/filters/filter-panel.js @@ -65,7 +65,7 @@ FilterPanel.prototype.show = function(focus) { this.$body .find('input, select, button:not(.js-filter-close)') .first() - .focus(); // TODO: jQuery deprecation + .trigger('focus'); } }; @@ -76,7 +76,7 @@ FilterPanel.prototype.hide = function() { } this.$body.removeClass('is-open'); this.$content.attr('aria-hidden', true); - this.$focus.focus(); // TODO: jQuery deprecation + this.$focus.trigger('focus'); removeTabindex(this.$form); $('body').removeClass('is-showing-filters'); this.isOpen = false; diff --git a/fec/fec/static/js/modules/filters/filter-typeahead.js b/fec/fec/static/js/modules/filters/filter-typeahead.js index 8827e5fca..9fc2983fa 100644 --- a/fec/fec/static/js/modules/filters/filter-typeahead.js +++ b/fec/fec/static/js/modules/filters/filter-typeahead.js @@ -161,7 +161,7 @@ FilterTypeahead.prototype.handleSelected = function(e, datum) { this.$elm.find('label[for="' + id + '"]').addClass('is-loading'); - this.$button.focus().addClass('is-loading'); + this.$button.trigger('focus').addClass('is-loading'); }; FilterTypeahead.prototype.handleAutocomplete = function(e, datum) { diff --git a/fec/fec/static/js/modules/filters/text-filter.js b/fec/fec/static/js/modules/filters/text-filter.js index b424cf8b3..b4724504d 100644 --- a/fec/fec/static/js/modules/filters/text-filter.js +++ b/fec/fec/static/js/modules/filters/text-filter.js @@ -63,7 +63,7 @@ TextFilter.prototype.handleChange = function() { // set the button focus within a timeout // to prevent change event from firing twice setTimeout(function() { - button.focus(); // TODO: jQuery deprecation + button.trigger('focus'); }, 0); if (value.length > 0) { diff --git a/fec/fec/static/js/modules/search.js b/fec/fec/static/js/modules/search.js index 07340a9d0..0a02b37f4 100644 --- a/fec/fec/static/js/modules/search.js +++ b/fec/fec/static/js/modules/search.js @@ -32,7 +32,7 @@ export default function Search($el, opts) { $(document.body).on('keyup', function(e) { // Focus search on "/" if (e.keyCode === KEYCODE_SLASH) { - $input.first().focus(); // TODO: jQuery deprecation + $input.first().trigger('focus'); } }); } diff --git a/fec/fec/static/js/modules/skip-nav.js b/fec/fec/static/js/modules/skip-nav.js index f2b315c0f..7213b055b 100644 --- a/fec/fec/static/js/modules/skip-nav.js +++ b/fec/fec/static/js/modules/skip-nav.js @@ -28,6 +28,6 @@ Skipnav.prototype.focusOnTarget = function(e) { if (e.keyCode === 13 || e.type === 'click') { this.$target.attr('tabindex', '0'); - this.$target.focus(); // TODO: jQuery deprecation + this.$target.trigger('focus'); } }; diff --git a/fec/fec/static/js/modules/tables.js b/fec/fec/static/js/modules/tables.js index 11a28ce21..ed0038f96 100644 --- a/fec/fec/static/js/modules/tables.js +++ b/fec/fec/static/js/modules/tables.js @@ -235,7 +235,7 @@ export function modalRenderFactory(template, fetch) { $modal.find('.js-pdf_url').remove(); } // Set focus on the close button - $('.js-hide').focus(); // TODO: jQuery deprecation + $('.js-hide').trigger('focus'); // When under $large-screen // TODO figure way to share these values with CSS. @@ -260,7 +260,7 @@ export function modalRenderFactory(template, fetch) { } function hidePanel(api, $modal) { - $('.row-active .js-panel-button').focus(); // TODO: jQuery deprecation + $('.row-active .js-panel-button').trigger('focus'); $('.js-panel-toggle tr').toggleClass('row-active', false); $('body').toggleClass('panel-active', false); $modal.attr('aria-hidden', 'true'); diff --git a/fec/fec/static/js/pages/contact-form.js b/fec/fec/static/js/pages/contact-form.js index e46aab7aa..96e84f681 100644 --- a/fec/fec/static/js/pages/contact-form.js +++ b/fec/fec/static/js/pages/contact-form.js @@ -43,8 +43,8 @@ ContactForm.prototype.initTypeahead = function() { //focus away to prompt removal of error state, if present. Could only focus into... //...another field, Attempts to focusout, or focus onto body, did not work. $('#id_u_contact_title') - .focus() // TODO: jQuery deprecation - .blur(); // TODO: jQuery deprecation + .trigger('focus') + .trigger('blur'); }); }; diff --git a/fec/fec/static/js/pages/reporting-dates-tables.js b/fec/fec/static/js/pages/reporting-dates-tables.js index 848d2a366..eee545dde 100644 --- a/fec/fec/static/js/pages/reporting-dates-tables.js +++ b/fec/fec/static/js/pages/reporting-dates-tables.js @@ -367,7 +367,7 @@ ReportingDates.prototype.mediaQueryResponse = function(mql) { for (const close of jsmodalClose) { close.addEventListener('click', () => { jsmodal[0].setAttribute('aria-hidden', 'true'); - close.focus(); // TODO: jQuery deprecation + close.trigger('focus'); }); } });