Fix: Prevent default behavior while scrolling using arrow keys in a horizontal listbox

This commit is contained in:
Jelle Postma 2022-02-28 11:09:24 +01:00 committed by jorenbroekema
parent 6417253c4e
commit 1ea9f291b6
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/listbox': patch
---
Fix: Prevent default behavior while scrolling using arrow keys in a horizontal listbox

View file

@ -589,6 +589,7 @@ const ListboxMixinImplementation = superclass =>
} }
break; break;
case 'ArrowLeft': case 'ArrowLeft':
ev.preventDefault();
if (this.orientation === 'horizontal') { if (this.orientation === 'horizontal') {
this.activeIndex = this._getPreviousEnabledOption(this.activeIndex); this.activeIndex = this._getPreviousEnabledOption(this.activeIndex);
} }
@ -600,6 +601,7 @@ const ListboxMixinImplementation = superclass =>
} }
break; break;
case 'ArrowRight': case 'ArrowRight':
ev.preventDefault();
if (this.orientation === 'horizontal') { if (this.orientation === 'horizontal') {
this.activeIndex = this._getNextEnabledOption(this.activeIndex); this.activeIndex = this._getNextEnabledOption(this.activeIndex);
} }