function toggle(e) {
		if (
			e.target instanceof HTMLInputElement ||
			e.target instanceof HTMLTextAreaElement ||
			e.target instanceof HTMLSelectElement ||
			e.target.contentEditable === "true"
		)
			return;

		const $details = this.parentElement;

		$details.toggleAttribute("open");
		if ($details.hasAttribute("open")) {
			$details.onexpand?.(true);
		} else {
			$details.onexpand?.(false);
		}
	}
A function that toggles the 'open' attribute on the parent element of the div
and calls the onexpand function of the parent element if it exists.

@this {HTMLElement} The div element that the function is bound to.
@param {MouseEvent} e - The event object from the click event.