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

Commit

Permalink
πŸ› Koenig - Fixed Firefox cursor getting stuck on cards when pressing Up
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kevinansfield committed Jul 23, 2018
1 parent 4ca5e30 commit 0b9aad8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/koenig-editor/addon/options/key-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ export const DEFAULT_KEY_COMMANDS = [{

if (isCollapsed && (offset === 0 || section.isCardSection) && !prevSection) {
koenig.send('exitCursorAtTop');
return false;
}

// Firefox has a bug with cursor movement where it will stop the cursor
// from moving upwards when a card is selected. Default behaviour in
// all other browsers is to place the cursor at the end of the previous
// section so we replicate that here
if (section.isCardSection && prevSection) {
koenig.moveCaretToTailOfSection(prevSection, false);
return;
}

return false;
Expand Down

0 comments on commit 0b9aad8

Please sign in to comment.