keyboard nav in tree view.
This commit is contained in:
parent
5c76f9f3a2
commit
a8a51718fc
2 changed files with 73 additions and 26 deletions
|
|
@ -6,6 +6,7 @@ type ComponentInstance = {
|
|||
state: any;
|
||||
update: (state: any) => (event: any) => any;
|
||||
view: (state: any) => any;
|
||||
focusable: boolean;
|
||||
};
|
||||
|
||||
export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
||||
|
|
@ -79,13 +80,15 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
instance = {
|
||||
state: ui.init,
|
||||
update: ui.update,
|
||||
view: ui.view
|
||||
view: ui.view,
|
||||
focusable: ui.focusable?._tag === 'True'
|
||||
};
|
||||
componentInstances.set(fullKey, instance);
|
||||
} else {
|
||||
// refresh closures, pick up new values
|
||||
instance.update = ui.update;
|
||||
instance.view = ui.view;
|
||||
instance.focusable = ui.focusable?._tag === 'True'
|
||||
}
|
||||
|
||||
if (ui.autoFocus?._tag === 'True' && isNew) {
|
||||
|
|
@ -209,6 +212,10 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
}
|
||||
|
||||
if (event._tag === 'ComponentEvent') {
|
||||
const instance = componentInstances.get(event._0);
|
||||
if (instance?.focusable) {
|
||||
setFocus(event._0);
|
||||
}
|
||||
handleComponentEvent(event._0, event._1);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue