Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions src/BloomBrowserUI/collectionsTab/BookButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,24 @@ export const BookButton: React.FunctionComponent<{
};

const handleClick = (event: React.MouseEvent<HTMLElement>) => {
if (props.book.id !== props.manager.getSelectedBookInfo()?.id) {
// Not only is it useless to select the book that is already selected,
// it might have side effects. This might have been a contributing factor
// to the rename box getting blurred when clicked in.
setSelectedBookIdWithApi(props.book.id);
}
if (event.detail === 1) {
setTimeout(() => {
if (props.book.id !== props.manager.getSelectedBookInfo()?.id) {
// Not only is it useless to select the book that is already selected,
// it might have side effects. This might have been a contributing factor
// to the rename box getting blurred when clicked in.
setSelectedBookIdWithApi(props.book.id);
}

// There's a default right-click menu implemented by C# code which we don't want here.
// Also BooksOfCollection implements a different context menu when a click isn't
// intercepted here, and we don't want to get it as well.
event.preventDefault();
event.stopPropagation();
// There's a default right-click menu implemented by C# code which we don't want here.
// Also BooksOfCollection implements a different context menu when a click isn't
// intercepted here, and we don't want to get it as well.
event.preventDefault();
event.stopPropagation();
}, 200);
} else if (event.detail === 2) {
handleDoubleClick(event);
}
};

const handleDoubleClick = (event: React.MouseEvent<HTMLElement>) => {
Expand Down Expand Up @@ -448,7 +454,6 @@ export const BookButton: React.FunctionComponent<{
variant="outlined"
size="large"
title={props.book.folderPath}
onDoubleClick={handleDoubleClick}
onClick={e => handleClick(e)}
onContextMenu={e => handleContextClick(e)}
startIcon={
Expand Down