-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(frontend): sets autofocus on select field on desktop #4456
Changes from 22 commits
100b7a9
7b7bd36
2c4b9fc
b673abe
dc3fd9b
8f5b407
57abaf1
64d6132
0d9a3db
2dd2731
26c5272
3f3f438
a4e11d0
a0d9c87
329f42a
80c2049
8628f84
7e359ff
1d645dd
38837be
4c1771d
1a3d7b2
adf85c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
<script lang="ts"> | ||
import { Input } from '@dfinity/gix-components'; | ||
import { nonNullish } from '@dfinity/utils'; | ||
import { onMount } from 'svelte'; | ||
|
||
export let value = ''; | ||
export let name: string; | ||
export let placeholder: string; | ||
export let required = true; | ||
export let testId: string | undefined = undefined; | ||
export let autofocus = false; | ||
peterpeterparker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let inputElement: HTMLInputElement | undefined; | ||
|
||
onMount(() => { | ||
peterpeterparker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (autofocus && nonNullish(inputElement)) { | ||
inputElement.focus(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note—I assume you tested this after the change in Gix components. Spontaneously, I would rather use an auto-subscriber, as I'm not sure the reference to the DOM element would always be established when the component is mounted. But I'm probably just being paranoid. ;) |
||
} | ||
}); | ||
</script> | ||
|
||
<Input | ||
|
@@ -18,6 +29,7 @@ | |
autocomplete="off" | ||
{testId} | ||
on:nnsInput | ||
bind:inputElement | ||
> | ||
<slot name="inner-end" slot="inner-end" /> | ||
</Input> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this
next
of Gix components version contains solely the changes for this PR or does it contains other changes? If the later, it's cleaner I think to provide the upgrade in a dedicated PR. If the former, nvm this comment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterpeterparker This provides all the changes made since december 10th. I will create a separate PR for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterpeterparker I just opened the PR: #4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx!