Skip to content

Commit 8994eb1

Browse files
authored
feat: add .focus() on components (#67)
2 parents fcac4a1 + c5481d2 commit 8994eb1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ export class Component<T extends HTMLElement = HTMLElement> extends ElementCompo
9898
return this.node.matches(selectors);
9999
}
100100

101+
/**
102+
* Puts the element into
103+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus focus}.
104+
* @param options - An optional object for controlling aspects of the focusing process.
105+
*/
106+
public focus(options?: FocusOptions): typeof this {
107+
this.node.focus(options);
108+
return this;
109+
}
110+
101111
/**
102112
* Set style property
103113
* @param name Property name

0 commit comments

Comments
 (0)