Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/FocusEvent.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { WeakRefInstance } from "./WeakRefInstance.mts";

export const KEYBORG_FOCUSIN = "keyborg:focusin";
export const KEYBORG_FOCUSOUT = "keyborg:focusout";

Expand All @@ -17,8 +15,8 @@ interface KeyborgFocus {
interface KeyborgFocusEventData {
focusInHandler: (e: FocusEvent) => void;
focusOutHandler: (e: FocusEvent) => void;
lastFocusedProgrammatically?: WeakRefInstance<HTMLElement>;
shadowTargets: Set<WeakRefInstance<ShadowRoot>>;
lastFocusedProgrammatically?: WeakRef<HTMLElement>;
shadowTargets: Set<WeakRef<ShadowRoot>>;
}

/**
Expand Down Expand Up @@ -101,7 +99,7 @@ export function setupFocusEvent(win: Window): void {

kwin.HTMLElement.prototype.focus = focus;

const shadowTargets: Set<WeakRefInstance<ShadowRoot>> = new Set();
const shadowTargets: Set<WeakRef<ShadowRoot>> = new Set();

const focusOutHandler = (e: FocusEvent) => {
const target = e.target as HTMLElement;
Expand Down Expand Up @@ -227,7 +225,7 @@ export function setupFocusEvent(win: Window): void {
shadowRoot.addEventListener("focusin", focusInHandler, true);
shadowRoot.addEventListener("focusout", focusOutHandler, true);

shadowTargets.add(new WeakRefInstance(shadowRoot));
shadowTargets.add(new WeakRef(shadowRoot));

return;
}
Expand Down Expand Up @@ -281,9 +279,7 @@ export function setupFocusEvent(win: Window): void {
.__keyborgData;

if (keyborgNativeFocusEvent) {
keyborgNativeFocusEvent.lastFocusedProgrammatically = new WeakRefInstance(
this,
);
keyborgNativeFocusEvent.lastFocusedProgrammatically = new WeakRef(this);
}

// eslint-disable-next-line prefer-rest-params
Expand Down
7 changes: 1 addition & 6 deletions src/Keyborg.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
KEYBORG_FOCUSIN,
setupFocusEvent,
} from "./FocusEvent.mts";
import { Disposable } from "./WeakRefInstance.mts";

interface WindowWithKeyborg extends Window {
__keyborg?: {
Expand Down Expand Up @@ -37,7 +36,7 @@ export type KeyborgCallback = (isNavigatingWithKeyboard: boolean) => void;
/**
* Manages a collection of Keyborg instances in a window/document and updates keyborg state
*/
class KeyborgCore implements Disposable {
class KeyborgCore {
readonly id: string;

private _win?: WindowWithKeyborg;
Expand Down Expand Up @@ -117,10 +116,6 @@ class KeyborgCore implements Disposable {
}
}

isDisposed(): boolean {
return !!this._win;
}

/**
* Updates all keyborg instances with the keyboard navigation state
*/
Expand Down
54 changes: 0 additions & 54 deletions src/WeakRefInstance.mts

This file was deleted.

Loading