re: Creating A Custom, Accessible Drop Down VIEW POST

FULL DISCUSSION
 

Hi Emma! Thank you for sharing this, it's very useful!

Here's a quick tip I'd like to share.

Instead of writing document.querySelector()/document.querySelectorAll() multiple times, you could do this:

const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);

const list = $(".dropdown__list");
const listContainer = $(".dropdown__list-container");
const dropdownArrow = $(".dropdown__arrow");
const listItems = $$(".dropdown__list-item");

code of conduct - report abuse