hcengineering / hcengineering/platform

Bug: Signup > Create Workspace | Can not use "enter" key to submit my workspace name.

Open
#5,221 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
27.7k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

**Issue:**
After the "Signup" screen, the "Create Workspace" screen does not submit values if you hit enter.

**Description:**
The form is being submitted with evt.Key='Enter'. _form_ tag has its own submission which should be invalidated if evt.Key is being used to submit the form.

Submission function for reference:
[#https://github.com/hcengineering/platform/blob/main/plugins/login-resources/src/components/Form.svelte#L137-L145](https://github.com/hcengineering/platform/blob/main/plugins/login-resources/src/components/Form.svelte#L137-L145)

**Why Form.svelte is not giving this issue for login and signup?**
Possibly because those operations do not take that long and navigation happens very quickly. In case of Workspace creation, it takes a few seconds

**Reference:**
![image](https://github.com/hcengineering/platform/assets/33599674/6af587d3-5279-405d-bc1b-ded7d337e16d)

**Solution:**
We should add evt.preventDefault() on this keydown function.

Updated code:
```
on:keydown={(evt) => {
if (evt.key === 'Enter' && !inAction) {
evt.preventDefault()
validate($themeStore.language).then((res) => {
if (res) {
performAction(action)
}
})
}
}}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.