mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Added scroll-into-view behaviour for slash menu selection
no issue - when selecting items with arrow keys in the slash menu, scroll the selected item into view if it's not visible
This commit is contained in:
parent
1e639c2504
commit
79d9179289
@ -12,6 +12,7 @@
|
||||
role="menuitem"
|
||||
title="{{item.label}}"
|
||||
{{on "click" (fn @itemClicked item)}}
|
||||
{{did-update this.scrollIntoView (eq item @selectedItem)}}
|
||||
>
|
||||
<div class="{{kg-style "cardmenu-icon"}} {{item.iconClass}}" aria-hidden="true">{{svg-jar item.icon class="w7 h7"}}</div>
|
||||
<div class="{{kg-style "cardmenu-label"}}">{{item.label}}</div>
|
||||
|
@ -0,0 +1,14 @@
|
||||
import Component from '@glimmer/component';
|
||||
import {action} from '@ember/object';
|
||||
|
||||
export default class KoenigMenuContentComponent extends Component {
|
||||
@action
|
||||
scrollIntoView(element, [doScroll]) {
|
||||
if (doScroll) {
|
||||
element.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'nearest'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user