Skip to content

Commit

Permalink
UHF-8839: Add view id indentifier for selector
Browse files Browse the repository at this point in the history
  • Loading branch information
xkhaven committed Sep 20, 2023
1 parent b24ae46 commit c28a390
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/search-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

// Set focus on search result count
$(document).ajaxComplete(function onDataLoaded(e, xhr, settings) {
const resultCountEl = $('.unit-search__count-container')[0];
// Check form ID to prevent mixing on multi-form page
const viewDomId = settings.extraData.view_dom_id;
const resultsContainerEl = $(`[data-id-number=${ viewDomId }]`);
const resultCountEl = $(resultsContainerEl[0]).find('.unit-search__count-container')[0];

if (!resultCountEl) return;
resultCountEl.setAttribute('tabindex', '-1');
resultCountEl.focus();
Expand Down

0 comments on commit c28a390

Please sign in to comment.