Skip to content

Commit ad99b59

Browse files
committed
Focusin/focusout events for triggers
1 parent 58a9d98 commit ad99b59

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

warehouse/static/js/warehouse/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ docReady(() => {
147147
}
148148
});
149149

150+
docReady(() => {
151+
let dropdownTriggers = document.querySelectorAll("li.dropdown__trigger");
152+
for (let trigger of dropdownTriggers) {
153+
trigger.addEventListener("focusin", function () {
154+
trigger.querySelector("ul.dropdown__content").style.display = "block";
155+
});
156+
trigger.addEventListener("focusout", function () {
157+
trigger.querySelector("ul.dropdown__content").style.display = "none";
158+
});
159+
}
160+
});
161+
150162
const application = Application.start();
151163
const context = require.context("./controllers", true, /\.js$/);
152164
application.load(definitionsFromContext(context));

0 commit comments

Comments
 (0)