Skip to content

Commit 3c3de9a

Browse files
authored
Merge pull request #1929 from session-foundation/fix-caret-performance-issue
fix: remove caret animation causing perf issue
2 parents 5249236 + 6bf706b commit 3c3de9a

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

stylesheets/_session.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,10 @@
2121
word-break: break-all;
2222
}
2323

24-
@keyframes blink-caret {
25-
0%,
26-
100% {
27-
caret-color: transparent;
28-
}
29-
50% {
30-
caret-color: var(--text-primary-color);
31-
}
32-
}
33-
3424
input,
3525
textarea,
3626
div[role='textbox'] {
3727
caret-color: var(--text-primary-color);
38-
animation: blink-caret infinite linear alternate 0.75s;
39-
caret-animation: manual;
4028
}
4129

4230
* {

ts/components/leftpane/LeftPaneMessageSection.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import { OverlayMessage } from './overlay/OverlayMessage';
2323
import { OverlayMessageRequest } from './overlay/OverlayMessageRequest';
2424
import { OverlayChooseAction } from './overlay/choose-action/OverlayChooseAction';
2525
import { sectionActions } from '../../state/ducks/section';
26-
import { openConversationWithMessages } from '../../state/ducks/conversations';
26+
import {
27+
openConversationWithMessages,
28+
resetConversationExternal,
29+
} from '../../state/ducks/conversations';
2730
import { useKeyboardShortcut } from '../../hooks/useKeyboardShortcut';
2831
import { KbdShortcut } from '../../util/keyboardShortcuts';
2932
import { UserUtils } from '../../session/utils';
@@ -99,7 +102,15 @@ function useConversationListKeyboardShortcuts(conversationIds: Array<string>) {
99102
void openConversationWithMessages({ conversationKey: id, messageId: null });
100103
};
101104

105+
const closeOpenConversation = () => {
106+
window.inboxStore?.dispatch(resetConversationExternal());
107+
};
108+
102109
useKeyboardShortcut({ shortcut: KbdShortcut.openNoteToSelf, handler: openNoteToSelf });
110+
useKeyboardShortcut({
111+
shortcut: KbdShortcut.closeOpenConversation,
112+
handler: closeOpenConversation,
113+
});
103114
useKeyboardShortcut({
104115
shortcut: KbdShortcut.conversationNavigation1,
105116
handler: () => void openConversation(conversationIds[0]),

ts/util/keyboardShortcuts.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ const conversationNavigation = Object.fromEntries(
8686
// in the database and its an often overlooked feature with little lift and massive UX gains.
8787
export const KbdShortcut = {
8888
...conversationNavigation,
89+
closeOpenConversation: {
90+
name: 'Close Open Conversation',
91+
scope: 'global',
92+
withCtrl: true,
93+
keys: ['w'],
94+
},
95+
8996
keyboardShortcutModal: {
9097
name: 'Keyboard Shortcuts',
9198
scope: 'global',
@@ -206,6 +213,7 @@ export const KbdShortcutInformation: Record<string, Array<KbdShortcutOptions>> =
206213
KbdShortcut.createGroup,
207214
KbdShortcut.joinCommunity,
208215
KbdShortcut.openNoteToSelf,
216+
KbdShortcut.closeOpenConversation,
209217
KbdShortcut.conversationListSearch,
210218
KbdShortcut.keyboardShortcutModal,
211219
baseConversationNavigation,

0 commit comments

Comments
 (0)