fix: crash double-click handling for collection and collection item (#5151)

This commit is contained in:
sanish chirayath
2025-07-22 12:51:41 +05:30
committed by GitHub
parent 6c165eddf6
commit 9ea7659f61
2 changed files with 14 additions and 0 deletions

View File

@@ -217,6 +217,12 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
);
};
// prevent the parent's double-click handler from firing
const handleFolderDoubleClick = (e) => {
e.stopPropagation();
e.preventDefault();
};
const handleRightClick = (event) => {
const _menuDropdown = dropdownTippyRef.current;
if (_menuDropdown) {
@@ -358,6 +364,7 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
className={iconClassName}
style={{ color: 'rgb(160 160 160)' }}
onClick={handleFolderCollapse}
onDoubleClick={handleFolderDoubleClick}
/>
) : null}
</div>

View File

@@ -111,6 +111,12 @@ const Collection = ({ collection, searchText }) => {
dispatch(toggleCollection(collection.uid));
}
// prevent the parent's double-click handler from firing
const handleCollectionDoubleClick = (e) => {
e.stopPropagation();
e.preventDefault();
};
const handleRightClick = (event) => {
const _menuDropdown = menuDropdownTippyRef.current;
if (_menuDropdown) {
@@ -223,6 +229,7 @@ const Collection = ({ collection, searchText }) => {
className={`chevron-icon ${iconClassName}`}
style={{ width: 16, minWidth: 16, color: 'rgb(160 160 160)' }}
onClick={handleCollectionCollapse}
onDoubleClick={handleCollectionDoubleClick}
/>
<div className="ml-1 w-full" id="sidebar-collection-name">
{collection.name}