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
1 merge request!638#3483412:Remove hard coded tab index for filters
Pipeline #387768 failed
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 @@ ...@@ -4,6 +4,7 @@
moduleCategoryFilter, moduleCategoryFilter,
moduleCategoryVocabularies, moduleCategoryVocabularies,
activeTab, activeTab,
sourceFilters,
} from './stores'; } from './stores';
import { normalizeOptions, shallowCompare } from './util'; import { normalizeOptions, shallowCompare } from './util';
import { BASE_URL } from './constants'; import { BASE_URL } from './constants';
...@@ -85,8 +86,19 @@ ...@@ -85,8 +86,19 @@
return; return;
} }
// Tab without shift moves to next filter. // Tab without shift moves to next filter.
document.getElementsByName('securityCoverage')[0].focus(); const keys = Object.keys($sourceFilters);
event.preventDefault(); 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; 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