Web:Components:Fixed AccessRightSelect list not closing on the invitation panel on mobile and tablets when clicking outside the area.

This commit is contained in:
gazizova-vlada 2023-08-23 09:35:35 +03:00
parent f4542b089e
commit 047ea7fd44
4 changed files with 17 additions and 0 deletions

View File

@ -91,6 +91,7 @@ const AccessRightSelect = ({
key: currentItem?.key,
label: currentItem?.label,
}}
forceCloseClickOutside={true}
{...props}
/>
);

View File

@ -133,6 +133,7 @@ class ComboBox extends React.Component {
isLoading,
isNoFixedHeightOptions,
hideMobileView,
forceCloseClickOutside,
} = this.props;
const { tabIndex, ...props } = this.props;
const { isOpen, selectedOption } = this.state;
@ -231,6 +232,7 @@ class ComboBox extends React.Component {
withBackground={withBackground}
isMobileView={isMobileView && !disableMobileView}
isNoFixedHeightOptions={isNoFixedHeightOptions}
forceCloseClickOutside={forceCloseClickOutside}
>
{advancedOptions
? advancedOptions

View File

@ -53,6 +53,10 @@ class DropDown extends React.PureComponent {
}
componentDidMount() {
if (this.props.forceCloseClickOutside) {
window.addEventListener("click", this.onClickOutsideAccessRightSelect);
}
if (this.props.open) {
this.props.enableOnClickOutside();
if (this.props.isDefaultMode) {
@ -63,6 +67,10 @@ class DropDown extends React.PureComponent {
}
componentWillUnmount() {
if (this.props.forceCloseClickOutside) {
window.removeEventListener("click", this.onClickOutsideAccessRightSelect);
}
this.props.disableOnClickOutside();
this.unbindDocumentResizeListener();
}
@ -82,6 +90,11 @@ class DropDown extends React.PureComponent {
}
}
onClickOutsideAccessRightSelect = (e) => {
if (!this.props.open) return;
if (!this.dropDownRef.current.contains(e.target)) this.toggleDropDown(e);
};
handleClickOutside = (e) => {
if (e.type !== "touchstart") {
e.preventDefault();

View File

@ -107,6 +107,7 @@ const Footer = React.memo(
showDisabledItems
directionX={"right"}
directionY={"top"}
forceCloseClickOutside={true}
/>
)}