Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 0b9aad8

Browse files
committed
šŸ› Koenig - Fixed Firefox cursor getting stuck on cards when pressing Up
refs TryGhost/Ghost#9724 - Firefox has a bug that prevents the cursor from moving from one element to another when pressing <kbd>Up</kbd> in certain circumstances - added workaround that replicates the default behaviour that all other browsers have so that <kbd>Up</kbd> can always move to the previous section
1 parent 4ca5e30 commit 0b9aad8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ā€Žlib/koenig-editor/addon/options/key-commands.js

+10
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@ export const DEFAULT_KEY_COMMANDS = [{
254254

255255
if (isCollapsed && (offset === 0 || section.isCardSection) && !prevSection) {
256256
koenig.send('exitCursorAtTop');
257+
return false;
258+
}
259+
260+
// Firefox has a bug with cursor movement where it will stop the cursor
261+
// from moving upwards when a card is selected. Default behaviour in
262+
// all other browsers is to place the cursor at the end of the previous
263+
// section so we replicate that here
264+
if (section.isCardSection && prevSection) {
265+
koenig.moveCaretToTailOfSection(prevSection, false);
266+
return;
257267
}
258268

259269
return false;

0 commit comments

Comments
Ā (0)