From ecb4dbaea9cd901844c6edf73581f89013cf17bd Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Wed, 6 Mar 2024 17:09:46 -0800 Subject: [PATCH] [REF-2098] Allow overlay Close components to have on_click handlers (#2793) * [REF-2098] Allow overlay Close components to have on_click handlers The child of the Radix *Close components are passed `asChild`, meaning they are treated as the direct child of the Close itself. This causes the `on_click` handler attached to such an element to override the default `on_click` behavior of the Close, which is to close the overlay, thus breaking the desired behavior of the Close component. When creating a Close component, if the child has an `on_click` handler, then internally wrap it in a `Flex` so that the `Flex` gets the `asChild` treatment, and both the default on_click and the child's on_click are both fired. Bonus fix: pass `asChild` when constructing the `DrawerClose` to avoid a