mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 15:16:28 +08:00
19 lines
414 B
TypeScript
19 lines
414 B
TypeScript
import { computed } from '@preact/signals-core';
|
|
|
|
import { MenuItem } from './item.js';
|
|
|
|
export abstract class MenuFocusable extends MenuItem {
|
|
isFocused$ = computed(() => this.menu.currentFocused$.value === this);
|
|
|
|
override connectedCallback() {
|
|
super.connectedCallback();
|
|
this.dataset.focusable = 'true';
|
|
}
|
|
|
|
override focus() {
|
|
this.menu.focusTo(this);
|
|
}
|
|
|
|
abstract onPressEnter(): void;
|
|
}
|