Skip to content

Commit 1b2b07d

Browse files
committed
only apply stopPropagation to onAfterClose prop
1 parent 8d24157 commit 1b2b07d

File tree

9 files changed

+20
-39
lines changed

9 files changed

+20
-39
lines changed

packages/main/src/components/AnalyticalTable/ColumnHeader/ColumnHeaderModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { PopoverHorizontalAlign } from '@ui5/webcomponents-react/lib/PopoverHori
2020
import { StandardListItem } from '@ui5/webcomponents-react/lib/StandardListItem';
2121
import React, { CSSProperties, forwardRef, RefObject, useCallback } from 'react';
2222
import { Ui5PopoverDomRef } from '../../../interfaces/Ui5PopoverDomRef';
23-
import { stopPopoverPropagationProps } from '../../../internal/stopPopoverPropagationProps';
23+
import { stopPropagation } from '../../../internal/stopPropagation';
2424
import { ColumnType } from '../types/ColumnType';
2525

2626
export interface ColumnHeaderModalProperties {
@@ -116,7 +116,7 @@ export const ColumnHeaderModal = forwardRef((props: ColumnHeaderModalProperties,
116116
placementType={PlacementType.Bottom}
117117
ref={ref}
118118
style={staticStyle as CSSProperties}
119-
{...stopPopoverPropagationProps}
119+
onAfterClose={stopPropagation}
120120
>
121121
<List onItemClick={handleSort}>
122122
{isSortedAscending && (

packages/main/src/components/FilterBar/FilterDialog.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { Text } from '@ui5/webcomponents-react/lib/Text';
2727
import { Title } from '@ui5/webcomponents-react/lib/Title';
2828
import { TitleLevel } from '@ui5/webcomponents-react/lib/TitleLevel';
2929
import React, { Children, cloneElement, ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
30-
import { stopPopoverPropagationProps } from '../../internal/stopPopoverPropagationProps';
30+
import { stopPropagation } from '../../internal/stopPropagation';
3131
import styles from './FilterBarDialog.jss';
3232
import { filterValue, renderSearchWithValue } from './utils';
3333

@@ -106,7 +106,7 @@ export const FilterDialog = (props) => {
106106

107107
const handleClose = useCallback(
108108
(e) => {
109-
e.stopPropagation();
109+
stopPropagation(e);
110110
if (!showGoButton) {
111111
handleSave(e);
112112
return;
@@ -270,13 +270,7 @@ export const FilterDialog = (props) => {
270270
}, [renderChildren, toggledFilters, handleCheckBoxChange]);
271271

272272
return (
273-
<Dialog
274-
ref={dialogRef}
275-
header={renderHeader()}
276-
footer={renderFooter()}
277-
{...stopPopoverPropagationProps}
278-
onAfterClose={handleClose}
279-
>
273+
<Dialog ref={dialogRef} header={renderHeader()} footer={renderFooter()} onAfterClose={handleClose}>
280274
<div className={classes.dialog}>
281275
{renderFBSearch && (
282276
<div className={classes.fbSearch} ref={searchRef}>

packages/main/src/components/MessageBox/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { TitleLevel } from '@ui5/webcomponents-react/lib/TitleLevel';
3737
import React, { FC, forwardRef, isValidElement, ReactNode, Ref, useCallback, useEffect, useMemo } from 'react';
3838
import { CommonProps } from '../../interfaces/CommonProps';
3939
import { Ui5DialogDomRef } from '../../interfaces/Ui5DialogDomRef';
40-
import { stopPopoverPropagationProps } from '../../internal/stopPopoverPropagationProps';
40+
import { stopPropagation } from '../../internal/stopPropagation';
4141
import styles from './MessageBox.jss';
4242

4343
const actionTextMap = new Map();
@@ -155,7 +155,7 @@ const MessageBox: FC<MessageBoxPropTypes> = forwardRef((props: MessageBoxPropTyp
155155
const handleOnClose = useCallback(
156156
(e) => {
157157
const { action } = e.target.dataset;
158-
e.stopPropagation();
158+
stopPropagation(e);
159159
onClose(enrichEventWithDetails(e, { action }));
160160
},
161161
[onClose]
@@ -175,10 +175,6 @@ const MessageBox: FC<MessageBoxPropTypes> = forwardRef((props: MessageBoxPropTyp
175175

176176
const passThroughProps = usePassThroughHtmlProps(props, ['onClose']);
177177

178-
const stopPropagation = (e) => {
179-
e.stopPropagation();
180-
};
181-
182178
return (
183179
<Dialog
184180
slot={slot}
@@ -208,7 +204,6 @@ const MessageBox: FC<MessageBoxPropTypes> = forwardRef((props: MessageBoxPropTyp
208204
})}
209205
</footer>
210206
}
211-
{...stopPopoverPropagationProps}
212207
onAfterClose={open ? handleOnClose : stopPropagation}
213208
{...passThroughProps}
214209
>

packages/main/src/components/ObjectPage/ObjectPageAnchorBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ToggleButton } from '@ui5/webcomponents-react/lib/ToggleButton';
1313
import React, { CSSProperties, forwardRef, ReactElement, RefObject, useCallback, useRef, useState } from 'react';
1414
import { createUseStyles } from 'react-jss';
1515
import { Ui5PopoverDomRef } from '../../interfaces/Ui5PopoverDomRef';
16-
import { stopPopoverPropagationProps } from '../../internal/stopPopoverPropagationProps';
16+
import { stopPropagation } from '../../internal/stopPropagation';
1717
import { StandardListItem } from '../../webComponents/StandardListItem';
1818
import { ObjectPageAnchorButton } from './ObjectPageAnchorButton';
1919
import { safeGetChildrenArray } from './ObjectPageUtils';
@@ -195,7 +195,7 @@ const ObjectPageAnchorBar = forwardRef((props: Props, ref: RefObject<HTMLElement
195195
data-ui5wcr-object-page-header-action=""
196196
/>
197197
)}
198-
<Popover placementType={PlacementType.Bottom} noArrow ref={popoverRef} {...stopPopoverPropagationProps}>
198+
<Popover placementType={PlacementType.Bottom} noArrow ref={popoverRef} onAfterClose={stopPropagation}>
199199
<List onItemClick={onSubSectionClick}>
200200
{popoverContent?.props?.children
201201
.filter((item) => item.props && item.props.isSubSection)

packages/main/src/components/SideNavigationListItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import React, {
2727
import { createPortal } from 'react-dom';
2828
import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createComponentStyles';
2929
import { CommonProps } from '../../interfaces/CommonProps';
30-
import { stopPopoverPropagationProps } from "../../internal/stopPopoverPropagationProps";
30+
import { stopPropagation } from '../../internal/stopPropagation';
3131
import { sideNavigationListItemStyles } from './SideNavigationListItem.jss';
3232

3333
export interface SideNavigationListItemProps extends CommonProps {
@@ -159,7 +159,7 @@ const SideNavigationListItem: FC<SideNavigationListItemProps> = forwardRef(
159159
{displayedIcon}
160160
<div className={classes.condensedExpandTriangle} />
161161
{createPortal(
162-
<Popover ref={popoverRef} verticalAlign={PopoverVerticalAlign.Top} {...stopPopoverPropagationProps}>
162+
<Popover ref={popoverRef} verticalAlign={PopoverVerticalAlign.Top} onAfterClose={stopPropagation}>
163163
<List onItemClick={props['onListItemSelected']}>
164164
<StandardListItem selected={isSelfSelected} data-id={id} tooltip={tooltip}>
165165
{text}

packages/main/src/components/Toolbar/OverflowPopover.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Popover } from '@ui5/webcomponents-react/lib/Popover';
66
import { ToggleButton } from '@ui5/webcomponents-react/lib/ToggleButton';
77
import React, { ReactElement, useCallback, useEffect, useRef, useState } from 'react';
88
import { createPortal } from 'react-dom';
9-
import { stopPopoverPropagationProps } from '../../internal/stopPopoverPropagationProps';
9+
import { stopPropagation } from '../../internal/stopPropagation';
1010

1111
export function OverflowPopover(props) {
1212
const { lastVisibleIndex, contentClass, children } = props;
@@ -33,7 +33,7 @@ export function OverflowPopover(props) {
3333
}, []);
3434

3535
const handleClose = (e) => {
36-
e.stopPropagation();
36+
stopPropagation(e);
3737
setPressed(false);
3838
};
3939

@@ -67,12 +67,7 @@ export function OverflowPopover(props) {
6767
pressed={pressed}
6868
/>
6969
{createPortal(
70-
<Popover
71-
placementType={PlacementType.Bottom}
72-
ref={popoverRef}
73-
{...stopPopoverPropagationProps}
74-
onAfterClose={handleClose}
75-
>
70+
<Popover placementType={PlacementType.Bottom} ref={popoverRef} onAfterClose={handleClose}>
7671
<div className={contentClass}>{renderChildren()}</div>
7772
</Popover>,
7873
document.body

packages/main/src/components/VariantManagement/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { TitleLevel } from '@ui5/webcomponents-react/lib/TitleLevel';
1919
import React, { FC, forwardRef, Ref, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2020
import { CommonProps } from '../../interfaces/CommonProps';
2121
import { Ui5ResponsivePopoverDomRef } from '../../interfaces/Ui5ResponsivePopoverDomRef';
22-
import { stopPopoverPropagationProps } from '../../internal/stopPopoverPropagationProps';
22+
import { stopPropagation } from '../../internal/stopPropagation';
2323

2424
export interface VariantItem {
2525
key: string;
@@ -171,7 +171,7 @@ const VariantManagement: FC<VariantManagementPropTypes> = forwardRef(
171171
headerText={popupTitle}
172172
placementType={placement}
173173
footer={footerButtons}
174-
{...stopPopoverPropagationProps}
174+
onAfterClose={stopPropagation}
175175
>
176176
<List onItemClick={handleVariantItemSelect} mode={ListMode.SingleSelect}>
177177
{variantItems.map((item) => (

packages/main/src/internal/stopPopoverPropagationProps.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const stopPropagation = (e) => {
2+
e.stopPropagation();
3+
e.stopImmediatePropagation();
4+
};

0 commit comments

Comments
 (0)