File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
@headlessui-react/src/components/popover
@headlessui-vue/src/components/popover Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [ Unreleased - React]
9
9
10
- - Nothing yet!
10
+ ### Fixes
11
+
12
+ - Stop the event from propagating in the ` Popover ` component ([ #798 ] ( https://github.com/tailwindlabs/headlessui/pull/798 ) )
11
13
12
14
## [ Unreleased - Vue]
13
15
14
- - Nothing yet!
16
+ ### Fixes
17
+
18
+ - Stop the event from propagating in the ` Popover ` component ([ #798 ] ( https://github.com/tailwindlabs/headlessui/pull/798 ) )
15
19
16
20
## [ @headlessui/react @v1.4.1] - 2021-08-30
17
21
Original file line number Diff line number Diff line change @@ -353,6 +353,8 @@ let Button = forwardRefWithAs(function Button<TTag extends ElementType = typeof
353
353
if ( state . popoverState !== PopoverStates . Open ) return closeOthers ?.( state . buttonId )
354
354
if ( ! internalButtonRef . current ) return
355
355
if ( ! internalButtonRef . current . contains ( document . activeElement ) ) return
356
+ event . preventDefault ( )
357
+ event . stopPropagation ( )
356
358
dispatch ( { type : ActionTypes . ClosePopover } )
357
359
break
358
360
@@ -603,6 +605,7 @@ let Panel = forwardRefWithAs(function Panel<TTag extends ElementType = typeof DE
603
605
if ( ! internalPanelRef . current ) return
604
606
if ( ! internalPanelRef . current . contains ( document . activeElement ) ) return
605
607
event . preventDefault ( )
608
+ event . stopPropagation ( )
606
609
dispatch ( { type : ActionTypes . ClosePopover } )
607
610
state . button ?. focus ( )
608
611
break
Original file line number Diff line number Diff line change @@ -304,6 +304,8 @@ export let PopoverButton = defineComponent({
304
304
if ( api . popoverState . value !== PopoverStates . Open ) return closeOthers ?.( api . buttonId )
305
305
if ( ! dom ( api . button ) ) return
306
306
if ( ! dom ( api . button ) ?. contains ( document . activeElement ) ) return
307
+ event . preventDefault ( )
308
+ event . stopPropagation ( )
307
309
api . closePopover ( )
308
310
break
309
311
@@ -571,6 +573,7 @@ export let PopoverPanel = defineComponent({
571
573
if ( ! dom ( api . panel ) ) return
572
574
if ( ! dom ( api . panel ) ?. contains ( document . activeElement ) ) return
573
575
event . preventDefault ( )
576
+ event . stopPropagation ( )
574
577
api . closePopover ( )
575
578
dom ( api . button ) ?. focus ( )
576
579
break
You can’t perform that action at this time.
0 commit comments