Avoid "Cannot read property 'top' of undefined" in toolbar

Can happen when using up and down keys without selection

Bug: T282607
Change-Id: Ibf7b4711fe7d0ebc14638a77770acff9149a9d7a
This commit is contained in:
Umherirrender 2021-05-29 19:01:33 +02:00
parent 1fc35f7b2b
commit fbcc93d98c

View file

@ -797,7 +797,8 @@
handleKeyDown: function ( $element, event, $parent ) {
var $nextItem,
$currentItem = $element.find( '.wikiEditor-character-highlighted' ),
optionTop = $parent.find( '.wikiEditor-character-highlighted' ).offset().top,
optionOffset = $parent.find( '.wikiEditor-character-highlighted' ).offset(),
optionTop = optionOffset ? optionOffset.top : 0,
selectTop = $parent.offset().top;
switch ( event.keyCode ) {
// Up arrow