Skip to content

Commit f26a080

Browse files
committed
fix:added focus for other buttons still need to add for others
1 parent d9ce3a4 commit f26a080

File tree

10 files changed

+6
-126
lines changed

10 files changed

+6
-126
lines changed

src/lib/components/feedback/evaluation.svelte

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
32
import { Tag } from '@appwrite.io/pink-svelte';
43
54
export let value: number = null;
6-
7-
onMount(() => {
8-
setTimeout(() => {
9-
const firstButton = document.querySelector('[data-rating="0"]') as HTMLElement;
10-
if (firstButton) {
11-
firstButton.focus();
12-
}
13-
}, 150);
14-
});
155
</script>
166

177
<fieldset class="u-margin-block-start-8 u-min-width-0">

src/lib/components/modal.svelte

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
};
1515
export let title = '';
1616
export let hideFooter = false;
17-
export let autoFocus = true;
1817
1918
let alert: HTMLElement;
2019
@@ -27,44 +26,6 @@
2726
$: if (error) {
2827
alert?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
2928
}
30-
31-
$: if (show && autoFocus) {
32-
setTimeout(() => {
33-
focusFirstElement();
34-
}, 100);
35-
}
36-
37-
function focusFirstElement() {
38-
const modalDialog = document.querySelector('dialog[open]') as HTMLElement;
39-
if (!modalDialog) return;
40-
41-
const autofocusElement = modalDialog.querySelector('[autofocus]') as HTMLElement;
42-
if (autofocusElement) {
43-
autofocusElement.focus();
44-
return;
45-
}
46-
const activeElement = document.activeElement;
47-
if (activeElement && modalDialog.contains(activeElement)) {
48-
return;
49-
}
50-
const focusableSelectors = [
51-
'input:not([disabled]):not([readonly]):not([type="hidden"])',
52-
'textarea:not([disabled]):not([readonly])',
53-
'select:not([disabled])',
54-
'button:not([disabled])',
55-
'a[href]:not([disabled])',
56-
'[tabindex]:not([tabindex="-1"]):not([disabled])',
57-
'.card-selector:not([disabled])',
58-
'[role="button"]:not([disabled])',
59-
'[role="link"]:not([disabled])',
60-
'[contenteditable="true"]:not([disabled])'
61-
].join(', ');
62-
63-
const firstFocusable = modalDialog.querySelector(focusableSelectors) as HTMLElement;
64-
if (firstFocusable) {
65-
firstFocusable.focus();
66-
}
67-
}
6829
</script>
6930

7031
<Form isModal {onSubmit}>

src/lib/layout/createProject.svelte

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
32
import { Layout, Typography, Input, Tag, Icon } from '@appwrite.io/pink-svelte';
43
import { IconPencil } from '@appwrite.io/pink-icons-svelte';
54
import { CustomId } from '$lib/components/index.js';
@@ -15,30 +14,6 @@
1514
export let showTitle = true;
1615
1716
let showCustomId = false;
18-
19-
onMount(() => {
20-
setTimeout(() => {
21-
let nameInput = document.querySelector(
22-
'input[placeholder="Project name"]'
23-
) as HTMLInputElement;
24-
if (!nameInput) {
25-
nameInput = document.querySelector(
26-
'input[type="text"]:first-of-type'
27-
) as HTMLInputElement;
28-
}
29-
if (!nameInput) {
30-
nameInput = document.querySelector('input:first-of-type') as HTMLInputElement;
31-
}
32-
33-
console.log('CreateProject - Found input:', nameInput);
34-
if (nameInput) {
35-
nameInput.focus();
36-
console.log('CreateProject - Focused project name input');
37-
} else {
38-
console.log('CreateProject - Could not find project name input');
39-
}
40-
}, 150);
41-
});
4217
</script>
4318

4419
<svelte:head>

src/routes/(console)/create-organization/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
bind:value={name}
187187
label="Organization name"
188188
placeholder="Enter organization name"
189+
autofocus
189190
id="name"
190191
required />
191192
</Fieldset>

src/routes/(console)/onboarding/create-organization/+page.svelte

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
32
import { isCloud } from '$lib/system';
43
import { sdk } from '$lib/stores/sdk';
54
import { ID } from '@appwrite.io/console';
@@ -16,29 +15,6 @@
1615
let isLoading = false;
1716
let organizationName = 'Personal Projects';
1817
19-
onMount(() => {
20-
setTimeout(() => {
21-
let nameInput = document.querySelector(
22-
'input[placeholder="Personal Projects"]'
23-
) as HTMLInputElement;
24-
if (!nameInput) {
25-
nameInput = document.querySelector('input[type="text"]') as HTMLInputElement;
26-
}
27-
if (!nameInput) {
28-
nameInput = document.querySelector('input') as HTMLInputElement;
29-
}
30-
31-
console.log('Found input:', nameInput);
32-
if (nameInput) {
33-
nameInput.focus();
34-
nameInput.select();
35-
console.log('Focused organization name input');
36-
} else {
37-
console.log('Could not find organization name input');
38-
}
39-
}, 100);
40-
});
41-
4218
async function createOrganization() {
4319
isLoading = true;
4420
let organization = null;

src/routes/(console)/onboarding/create-project/+page.svelte

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
32
import { Card, Layout, Button } from '@appwrite.io/pink-svelte';
43
import { isCloud } from '$lib/system';
54
import { sdk } from '$lib/stores/sdk';
@@ -23,29 +22,6 @@
2322
2423
export let data;
2524
26-
onMount(() => {
27-
setTimeout(() => {
28-
let nameInput = document.querySelector(
29-
'input[placeholder="Project name"]'
30-
) as HTMLInputElement;
31-
if (!nameInput) {
32-
nameInput = document.querySelector('input[type="text"]') as HTMLInputElement;
33-
}
34-
if (!nameInput) {
35-
nameInput = document.querySelector('input') as HTMLInputElement;
36-
}
37-
38-
console.log('Found input:', nameInput);
39-
if (nameInput) {
40-
nameInput.focus();
41-
nameInput.select();
42-
console.log('Focused project name input');
43-
} else {
44-
console.log('Could not find project name input');
45-
}
46-
}, 100);
47-
});
48-
4925
function markOnboardingComplete() {
5026
const currentPrefs = data.accountPrefs ?? $user.prefs;
5127

src/routes/(console)/organization-[organization]/createMember.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
name: string,
2727
error: string,
2828
role: string = isSelfHosted ? 'owner' : 'developer';
29+
emailInput: HTMLInputElement;
2930
3031
async function create() {
3132
try {
@@ -70,7 +71,7 @@
7071
id="email"
7172
label="Email"
7273
placeholder="Enter email"
73-
autofocus={true}
74+
autofocus
7475
bind:value={email} />
7576
<InputText id="member-name" label="Name" placeholder="Enter name" bind:value={name} />
7677
{#if isCloud}

src/routes/(console)/organization-[organization]/members/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<ConsoleButton
7474
size="s"
7575
event="create_user"
76-
on:mousedown={() => newMemberModal.set(true)}
76+
on:click={() => newMemberModal.set(true)}
7777
disabled={isCloud ? !$currentPlan?.addons?.seats?.supported : false}>
7878
<Icon size="s" icon={IconPlus} slot="start" />
7979
<span class="text">Invite</span>

src/routes/(console)/project-[region]-[project]/auth/createUser.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</script>
5757

5858
<Modal title="Create user" {error} bind:show={showCreate} onSubmit={create}>
59-
<InputText id="name" label="Name" placeholder="Enter name" autofocus={true} bind:value={name} />
59+
<InputText autofocus id="name" label="Name" placeholder="Enter name" bind:value={name} />
6060
<InputEmail id="email" label="Email" placeholder="Enter email" bind:value={mail} />
6161
<InputPhone id="phone" label="Phone" placeholder="Enter phone" bind:value={phone} />
6262
<InputPassword id="password" label="Password" placeholder="Enter password" bind:value={pass} />

src/routes/(console)/project-[region]-[project]/auth/teams/team-[team]/createMembership.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
label="Email"
5353
placeholder="Enter email"
5454
required={true}
55-
autofocus={true}
55+
autofocus
5656
bind:value={email} />
5757
<InputText id="name" label="Name" placeholder="Enter name" bind:value={name} />
5858
<Alert.Inline status="info">

0 commit comments

Comments
 (0)