Skip to content

Commit 046649b

Browse files
committed
fix(dashboard): Remove unnecessary reason check from dismiss prevention
Drop eventDetails.reason checks from onOpenChange — as the maintainer noted, onOpenChange is only called from Base UI's own interactions (outside-press, escape-key, focus-out), not from our programmatic setOpen(false) calls. Checking specific reasons would miss focus-out.
1 parent a299b57 commit 046649b

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

packages/dashboard/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,9 @@ export function CustomerAddressSelector({
9797
<Popover
9898
open={open}
9999
onOpenChange={(value, eventDetails) => {
100-
if (
101-
!value &&
102-
effectiveTab === 'new' &&
103-
(eventDetails.reason === 'outside-press' || eventDetails.reason === 'escape-key')
104-
) {
105-
eventDetails.cancel();
106-
return;
100+
// While the form tab is open, only our own submit/cancel may close the popover
101+
if (!value && effectiveTab === 'new') {
102+
return eventDetails.cancel();
107103
}
108104
setOpen(value);
109105
if (!value) {

packages/dashboard/src/lib/components/shared/customer-selector.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,9 @@ export function CustomerSelector(props: CustomerSelectorProps) {
234234
<Popover
235235
open={open}
236236
onOpenChange={(isOpen, eventDetails) => {
237-
if (
238-
!isOpen &&
239-
activeTab === 'new' &&
240-
(eventDetails.reason === 'outside-press' || eventDetails.reason === 'escape-key')
241-
) {
242-
eventDetails.cancel();
243-
return;
237+
// While the create tab is open, only our own submit/cancel may close the popover
238+
if (!isOpen && activeTab === 'new') {
239+
return eventDetails.cancel();
244240
}
245241
setOpen(isOpen);
246242
if (!isOpen) {

0 commit comments

Comments
 (0)