Skip to content

Commit 44d2cd9

Browse files
committed
Simplified the setFocus function
(removed typescript errors)
1 parent e3bcf61 commit 44d2cd9

File tree

7 files changed

+7
-15
lines changed

7 files changed

+7
-15
lines changed

packages/uui-ref-node-data-type/lib/uui-ref-node-data-type.story.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/web-components-vite';
55
import { renderSlots, spread } from '../../../storyhelpers';
66

77
const setFocus = () => {
8-
const refElement = document.querySelectorAll('#refNode');
9-
refElement[0].focus();
8+
document.getElementById('refNode')?.focus();
109
};
1110

1211
const meta: Meta = {

packages/uui-ref-node-document-type/lib/uui-ref-node-document-type.story.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/web-components-vite';
55
import { renderSlots, spread } from '../../../storyhelpers';
66

77
const setFocus = () => {
8-
const refElement = document.querySelectorAll('#refNode');
9-
refElement[0].focus();
8+
document.getElementById('refNode')?.focus();
109
};
1110

1211
const meta: Meta = {

packages/uui-ref-node-form/lib/uui-ref-node-form.story.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/web-components-vite';
55
import { renderSlots, spread } from '../../../storyhelpers';
66

77
const setFocus = () => {
8-
const refElement = document.querySelectorAll('#refNode');
9-
refElement[0].focus();
8+
document.getElementById('refNode')?.focus();
109
};
1110

1211
const meta: Meta = {

packages/uui-ref-node-member/lib/uui-ref-node-member.story.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/web-components-vite';
55
import { renderSlots, spread } from '../../../storyhelpers';
66

77
const setFocus = () => {
8-
const refElement = document.querySelectorAll('#refNode');
9-
refElement[0].focus();
8+
document.getElementById('refNode')?.focus();
109
};
1110

1211
const meta: Meta = {

packages/uui-ref-node-package/lib/uui-ref-node-package.story.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/web-components-vite';
55
import { renderSlots, spread } from '../../../storyhelpers';
66

77
const setFocus = () => {
8-
const refElement = document.querySelectorAll('#refNode');
9-
refElement[0].focus();
8+
document.getElementById('refNode')?.focus();
109
};
1110

1211
const meta: Meta = {

packages/uui-ref-node-user/lib/uui-ref-node-user.story.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/web-components-vite';
55
import { renderSlots, spread } from '../../../storyhelpers';
66

77
const setFocus = () => {
8-
const refElement = document.querySelectorAll('#refNode');
9-
refElement[0].focus();
8+
document.getElementById('refNode')?.focus();
109
};
1110

1211
const meta: Meta = {

packages/uui-ref-node/lib/uui-ref-node.story.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import '@umbraco-ui/uui-button/lib';
1010
import '@umbraco-ui/uui-icon/lib';
1111

1212
const setFocus = () => {
13-
const refElement = document.querySelectorAll('#refNode');
14-
console.log(refElement[0]);
15-
refElement[0].focus();
13+
document.getElementById('refNode')?.focus();
1614
};
1715

1816
const meta: Meta = {

0 commit comments

Comments
 (0)