Skip to content
Snippets Groups Projects
Commit f5bbcf1c authored by utkarsh_33's avatar utkarsh_33 Committed by Chris Wells
Browse files

Issue #3483412 by utkarsh_33, chrisfromredfin, kunal.sachdev, narendrar:...

Issue #3483412 by utkarsh_33, chrisfromredfin, kunal.sachdev, narendrar: Remove hard coded tab index for filters
parent f9fc1b78
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -4,6 +4,7 @@
moduleCategoryFilter,
moduleCategoryVocabularies,
activeTab,
sourceFilters,
} from './stores';
import { normalizeOptions, shallowCompare } from './util';
import { BASE_URL } from './constants';
......@@ -85,8 +86,19 @@
return;
}
// Tab without shift moves to next filter.
document.getElementsByName('securityCoverage')[0].focus();
event.preventDefault();
const keys = Object.keys($sourceFilters);
const filterMap = Object.fromEntries(Object.entries($sourceFilters));
const indexOfCategories = keys.indexOf('categories');
if (indexOfCategories !== -1 && indexOfCategories + 1 < keys.length) {
const nextKey = keys[indexOfCategories + 1];
const nextElement = $sourceFilters[nextKey];
const nextElementKey = Object.keys(filterMap).find(
(key) => filterMap[key] === nextElement,
);
document.getElementsByName(nextElementKey)[0].focus();
event.preventDefault();
}
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment