PageSourceSearch

https://www.uottawa.ca/about-us/themes/custom/uottawa/src/js/lib/fixtabindex0accessibility.js?tm67tf

js uottawa.ca collected 2026-10-01 07:29:06 UTC 1,504 bytes, 45 lines download raw bytes

1/* 
2Removes tabindex = "0" from elements inside of a container
3Usage:
4- in the WYSIWYG add the following code, before the element rendering code
5<script src="/themes/custom/uottawa/src/js/lib/fixtabindex0accessibility.js" type="text/javascript">removeTabindex('containerID');</scrip>
6
7*/
8(function (window) {
9  window.removeTabindex = function (containerID) {
10    if (!containerID) return;
11    // Observe DOM for changes
12    const observer = new MutationObserver(function (mutationsList) {
13      mutationsList.forEach(function (mutation) {
14        if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
15          mutation.addedNodes.forEach((node) => {
16            // Skip non-element nodes
17            if (node.nodeType !== 1) {
18              return;
19            }
20
21            let container = document.getElementById(containerID);
22            if (!container) return;
23
24            const tabIndexedElements =
25              container.querySelectorAll('[tabindex="0"]');
26
27            if (tabIndexedElements === null || tabIndexedElements.length === 0)
28              return;
29            console.log(tabIndexedElements);
30            tabIndexedElements.forEach((el) => {
31              el.removeAttribute("tabindex");
32              observer.disconnect(); // Stop observing if done
33            });
34          });
35        }
36      });
37    });
38
39    // Start observing the document
40    observer.observe(document.documentElement, {
41      childList: true,
42      subtree: true,
43    });
44  };
45})(window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.