From fd2afeba4e6902184b4554c60eee95c6864519d8 Mon Sep 17 00:00:00 2001 From: David Date: Sat, 3 Oct 2026 15:43:46 +0200 Subject: [PATCH] Invoices: a machine chosen in the dropdown was never actually booked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selecting a plant item in the Booked to dropdown silently did nothing. The menu opened, the option highlighted, and clicking it produced no request at all — the menu just closed. Reproduced with a real browser click: no POST to /book. The menu is rendered with createPortal(..., document.body) because the line table lives in an overflow-x-auto container that would clip an in-place dropdown. A portal is not a DOM descendant of the component that made it, so the click-away handler's `boxRef.contains(target)` reported every option as an outside click: mousedown closed the menu, React unmounted the button, and the click that would have booked it never landed. The menu now has its own ref and is treated as part of the control. Verified with a real click — the booking posts, the site clears, and the unbooked badge goes. The site dropdown was never affected; it is a native