PageSourceSearch

https://www.star-t.fr/modules/ratpdev/rdds/assets/js/open-target.js?tm8hsr

js star-t.fr collected 2026-10-07 06:07:26 UTC 1,586 bytes, 47 lines download raw bytes

1/**
2 * @file open-target.js
3 *
4 * JS File to open a target using aria-controls and aria-hidden.
5 */
6(function (Drupal, once) {
7  const openSelector = "[data-open-target]";
8  const focusableSelector = 'input:not([type="hidden"]), textarea, select';
9
10  /**
11   * @Behavior
12   *
13   * Open the aria-controls id target on [data-open-target] element click.
14   * If possible, focus on first form item in the target.
15   */
16  Drupal.behaviors.rddsOpenTarget = {
17    attach(context) {
18      once(
19        "openTarget",
20        context.querySelectorAll(openSelector),
21        context,
22      ).forEach(function (element) {
23        ["click", "touch"].forEach(function (e) {
24          element.addEventListener(e, function () {
25            const targetId = element.getAttribute("aria-controls");
26            // Open all buttons with the same target.
27            context
28              .querySelectorAll(`[aria-controls="${targetId}"]`)
29              .forEach(function (btn) {
30                btn.setAttribute("aria-expanded", "true");
31              });
32            // Open the target element.
33            context.querySelectorAll(`#${targetId}`).forEach(function (target) {
34              target.setAttribute("aria-hidden", "false");
35              target.setAttribute("tabindex", 0);
36              // On open, target on the first focusable element.
37              const targetAutoFocus = target.querySelector(focusableSelector);
38              if (targetAutoFocus) {
39                targetAutoFocus.focus();
40              }
41            });
42          });
43        });
44      });
45    },
46  };
47})(Drupal, once);

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.