22 AccessibilityNode ,
33 createAccessibilityTree ,
44} from "./createAccessibilityTree" ;
5- import type { CommandOptions , ScreenReader } from "@guidepup/guidepup" ;
65import { commands , type VirtualCommands } from "./commands/index" ;
76import {
87 ERR_VIRTUAL_MISSING_CONTAINER ,
@@ -74,7 +73,7 @@ export interface Root {
7473 MutationObserver ?: typeof MutationObserver ;
7574}
7675
77- export interface StartOptions extends CommandOptions {
76+ export interface StartOptions {
7877 /**
7978 * The bounding HTML element to use the Virtual Screen Reader in.
8079 *
@@ -200,7 +199,7 @@ const defaultUserEventOptions = {
200199 * });
201200 * ```
202201 */
203- export class Virtual implements ScreenReader {
202+ export class Virtual {
204203 #activeNode: AccessibilityNode | null = null ;
205204 #container: Node | null = null ;
206205 #cursor: HTMLDivElement | null = null ;
@@ -328,15 +327,14 @@ export class Virtual implements ScreenReader {
328327 // We've covered the tree having no length so there must be at least one
329328 // index or we default back to the beginning of the tree.
330329 const newActiveNode =
331-
332330 tree . find ( ( { node } ) => node === target ) ?? tree . at ( 0 ) ! ;
333331
334332 this . #updateState( newActiveNode , true ) ;
335333 }
336334
337335 #focusActiveElement( ) {
338336 // Is only called following a null guard for `this.#activeNode`.
339-
337+
340338 const target = getElementNode ( this . #activeNode! ) ;
341339 target ?. focus ( ) ;
342340 }
@@ -426,7 +424,7 @@ export class Virtual implements ScreenReader {
426424 // This only fires after keyboard like interactions, both of which null
427425 // guard the `this.#activeNode` so it stands that we should still be able
428426 // to find it in the tree.
429-
427+
430428 const newActiveNode = tree . at ( currentIndex ) ! ;
431429
432430 this . #updateState( newActiveNode , ignoreIfNoChange ) ;
@@ -700,7 +698,7 @@ export class Virtual implements ScreenReader {
700698 const nextIndex = currentIndex === - 1 ? 0 : currentIndex - 1 ;
701699 // We've covered the tree having no length so there must be at least one
702700 // index, and we ensure to zero-guard with the logic above.
703-
701+
704702 const newActiveNode = tree . at ( nextIndex ) ! ;
705703
706704 this . #updateState( newActiveNode ) ;
@@ -745,7 +743,7 @@ export class Virtual implements ScreenReader {
745743 : currentIndex + 1 ;
746744 // We've covered the tree having no length so there must be at least one
747745 // index, and we ensure to zero-guard with the logic above.
748-
746+
749747 const newActiveNode = tree . at ( nextIndex ) ! ;
750748
751749 this . #updateState( newActiveNode ) ;
@@ -966,7 +964,7 @@ export class Virtual implements ScreenReader {
966964 async perform <
967965 T extends keyof VirtualCommands ,
968966 K extends Omit < Parameters < VirtualCommands [ T ] > [ 0 ] , keyof VirtualCommandArgs >
969- > ( command : T , options ?: { [ L in keyof K ] : K [ L ] } & CommandOptions ) {
967+ > ( command : T , options ?: { [ L in keyof K ] : K [ L ] } ) {
970968 this . #checkContainer( ) ;
971969 await tick ( ) ;
972970
@@ -980,7 +978,7 @@ export class Virtual implements ScreenReader {
980978 const nextIndex = commands [ command ] ?.( {
981979 ...options ,
982980 // `this.#checkContainer();` above null guards us here.
983-
981+
984982 container : this . #container! ,
985983 currentIndex,
986984 tree,
@@ -992,7 +990,7 @@ export class Virtual implements ScreenReader {
992990
993991 // We know the tree has length, and we guard against the command not being
994992 // able to find an index in the tree so we are fine.
995-
993+
996994 const newActiveNode = tree . at ( nextIndex ) ! ;
997995 this . #updateState( newActiveNode ) ;
998996
0 commit comments