{% load vantage i18n %} {% comment %} The account menu: one avatar where three controls used to be spelled out in full. Read the two states in order, because the order is the point. WITHOUT JAVASCRIPT the trigger is what it looks like — a link to `vantage:account`, a page that lists every option below as an ordinary link or an ordinary form. The panel is `hidden`, and nothing here lies about itself: no aria-expanded on something that never expands, no role="button" on a link that navigates. A dropdown that only exists once a script has run is a dropdown that takes sign-out away from whoever the script did not reach, and sign-out is the one control in this panel that has to survive everything. WITH JAVASCRIPT vantage.js upgrades the same element into a menu button — role, aria-haspopup, aria-expanded, aria-controls — and takes over the click. The href stays, so a middle click or a ctrl-click still opens the account page. Sign out is a POST, and stays a POST. It is the reason it is a
and not a link: a GET sign-out is a URL that any prefetcher, link scanner or over-eager browser can fire, and the user finds themselves signed out by a mouse hover. The two forms sit outside the role="menu" element and are reached by the buttons' `form=` attribute. A is a generic element with no menu role, and a generic element inside role="menu" makes the menu's children unenumerable. {% endcomment %} {% url 'password_change' as password_change_url %} {% url 'logout' as logout_url %}