🐛 Koenig - Fixed Firefox cursor getting stuck on cards when pressing Up

refs https://github.com/TryGhost/Ghost/issues/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
This commit is contained in:
Kevin Ansfield 2018-07-23 13:45:49 +01:00
parent fb6bf6b97d
commit fc16a8f333

View File

@ -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;