;
+ registerer: Registerer;
} {
return {
container: this,
hasFocus: this.hasFocus,
- hasFocusWithin: this.hasFocusWithin
+ hasFocusWithin: this.hasFocusWithin,
+ registerer: this.getRegisterer()
};
}
private addChild(child: Container) {
this.children.push(child);
child.parent = this;
- this.htmlElement = undefined;
return this;
}
@@ -203,21 +288,16 @@ export class Container {
return this;
}
- private addHtmlElement(htmlElement: HTMLElement) {
- if (this.children.length > 0) {
- console.warn('Adding an html element to a container that has children.');
- for (const child of this.children) {
- this.removeChild(child);
- }
- }
- this.htmlElement = htmlElement;
- return this;
- }
-
- private removeHtmlElement() {
- this.htmlElement = undefined;
- return this;
- }
+ // private addHtmlElement(htmlElement: HTMLElement) {
+ // if (this.children.length > 0) {
+ // console.warn('Adding an html element to a container that has children.');
+ // for (const child of this.children) {
+ // this.removeChild(child);
+ // }
+ // }
+ // this.htmlElement = htmlElement;
+ // return this;
+ // }
private shouldFocusByDefault(): boolean {
return this.focusByDefault || this.parent?.shouldFocusByDefault() || false;
@@ -229,7 +309,12 @@ export function handleKeyboardNavigation(event: KeyboardEvent) {
if (!currentlyFocusedObject) {
console.error('No focused object!!!');
- mainContainer.focus();
+ // Find object that can be focused
+ Container.objects.forEach((container) => {
+ if (container.isFocusable()) {
+ container.focus();
+ }
+ });
return;
}
@@ -247,6 +332,8 @@ export function handleKeyboardNavigation(event: KeyboardEvent) {
}
export const focusedObject = Container.focusedObject;
-export const mainContainer = new Container('main')
- .setDirection('horizontal')
- .setFocusByDefault(true);
+// export const mainContainer = new Container('main')
+// .setDirection('horizontal')
+// .setFocusByDefault(true);
+
+export const registerer = Container.getRegisterer();
diff --git a/src/lib/components-new/NavbarItem.svelte b/src/lib/components-new/NavbarItem.svelte
index 945f056..2451c80 100644
--- a/src/lib/components-new/NavbarItem.svelte
+++ b/src/lib/components-new/NavbarItem.svelte
@@ -1,31 +1,28 @@
-
+
+
+
+
+
+
diff --git a/src/lib/components/Carousel/CarouselPlaceholderItems.svelte b/src/lib/components/Carousel/CarouselPlaceholderItems.svelte
index 6cb4710..3797076 100644
--- a/src/lib/components/Carousel/CarouselPlaceholderItems.svelte
+++ b/src/lib/components/Carousel/CarouselPlaceholderItems.svelte
@@ -1,37 +1,31 @@
- Index: {$focusIndexStore}
+ Index: {$focusIndex}
{#each Array(10) as _, i (i)}
-
-
+
{/each}
diff --git a/src/lib/components/Selectable.svelte b/src/lib/components/Selectable.svelte
index c42bd4d..fbaff60 100644
--- a/src/lib/components/Selectable.svelte
+++ b/src/lib/components/Selectable.svelte
@@ -2,13 +2,13 @@
import { Container } from '../actions/focusAction';
export let container: Container;
- const registerer = container.getHtmlElementRegisterer();
+ const registerer = container.getRegisterer();
export let handleClick = () => {
container.focus();
};
-