diff options
| author | 2025-09-16 14:30:00 +0200 | |
|---|---|---|
| committer | 2025-09-16 14:30:00 +0200 | |
| commit | 0a32fc0980477be3249d6aed9c79c3ec5e3a23aa (patch) | |
| tree | 116d485cfb4e8e5b14f7fd3d88bcaa5f45a7a283 /web | |
| parent | [bugfix/frontend] preserve whitespace in photoswipe captions (#4434) (diff) | |
| download | gotosocial-0a32fc0980477be3249d6aed9c79c3ec5e3a23aa.tar.xz | |
[bugfix] prevent clicking Enter in description field from deleting the image (#4436)
# Description
Change the type of "Delete header" / "Delete avatar" button to just "button" to prevent them from getting deleted if user presses Enter in the description field.
Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4363
## Checklist
Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [x] I/we have performed a self-review of added code.
- [x] I/we have written code that is legible and maintainable by others.
- [ ] I/we have commented the added code, particularly in hard-to-understand areas.
- [x] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [ ] I/we have run tests and they pass locally with the changes.
- [x] I/we have run `go fmt ./...` and `golangci-lint run`.
Co-authored-by: ptrcnull <git@ptrcnull.me>
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4436
Co-authored-by: ptrcnull <ptrcnull@noreply.codeberg.org>
Co-committed-by: ptrcnull <ptrcnull@noreply.codeberg.org>
Diffstat (limited to 'web')
| -rw-r--r-- | web/source/settings/components/form/mutation-button.tsx | 4 | ||||
| -rw-r--r-- | web/source/settings/views/user/profile/profile.tsx | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/web/source/settings/components/form/mutation-button.tsx b/web/source/settings/components/form/mutation-button.tsx index 5d831cd24..70f7086b6 100644 --- a/web/source/settings/components/form/mutation-button.tsx +++ b/web/source/settings/components/form/mutation-button.tsx @@ -27,6 +27,7 @@ export interface MutationButtonProps extends React.DetailedHTMLProps<React.Butto showError?: boolean, className?: string, wrapperClassName?: string, + submit?: boolean, } export default function MutationButton({ @@ -36,6 +37,7 @@ export default function MutationButton({ showError = true, className = "", wrapperClassName = "", + submit = true, ...inputProps }: MutationButtonProps) { let iconClass = ""; @@ -56,7 +58,7 @@ export default function MutationButton({ <Error error={result.error} reset={result.reset} /> } <button - type="submit" + type={submit ? "submit" : "button"} className={"with-icon " + className} disabled={result.isLoading || disabled} {...inputProps} diff --git a/web/source/settings/views/user/profile/profile.tsx b/web/source/settings/views/user/profile/profile.tsx index 6b59b7916..0c2e1f32a 100644 --- a/web/source/settings/views/user/profile/profile.tsx +++ b/web/source/settings/views/user/profile/profile.tsx @@ -184,6 +184,7 @@ function ProfileForm({ data: profile }: ProfileFormProps) { tabIndex={0} disabled={noHeader} result={deleteHeaderRes} + submit={false} onClick={(e) => { e.preventDefault(); deleteHeader().then(res => { @@ -215,6 +216,7 @@ function ProfileForm({ data: profile }: ProfileFormProps) { tabIndex={0} disabled={noAvatar} result={deleteAvatarRes} + submit={false} onClick={(e) => { e.preventDefault(); deleteAvatar().then(res => { |
