Skip to content

Add placeholders to input fields in various templates for better user…#37144

Draft
qobilovvv wants to merge 1 commit intogo-gitea:mainfrom
qobilovvv:main
Draft

Add placeholders to input fields in various templates for better user…#37144
qobilovvv wants to merge 1 commit intogo-gitea:mainfrom
qobilovvv:main

Conversation

@qobilovvv
Copy link
Copy Markdown

FIXES #37069

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 8, 2026
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Apr 8, 2026
@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 8, 2026

Could you post screen shots?

{{/* it is rendered as markdown, but the length is limited, so at the moment we do not use the markdown editor here */}}
<label for="description">{{ctx.Locale.Tr "user.user_bio"}}</label>
<textarea id="description" name="description" rows="2" placeholder="{{ctx.Locale.Tr "settings.biography_placeholder"}}" maxlength="255">{{.SignedUser.Description}}</textarea>
<textarea id="description" name="description" rows="2" placeholder="I am a developer from San Francisco." maxlength="255">{{.SignedUser.Description}}</textarea>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change it from a translatable string?

<div class="field">
<label for="location">{{ctx.Locale.Tr "settings.location"}}</label>
<input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50">
<input id="location" name="location" placeholder="San Francisco, CA" value="{{.SignedUser.Location}}" maxlength="50">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above question

<div class="field {{if .Err_FullName}}error{{end}}">
<label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label>
<input id="full_name" name="full_name" value="{{.User.FullName}}" maxlength="100">
<input id="full_name" name="full_name" value="{{.User.FullName}}" maxlength="100" placeholder="John Doe">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original issue had @wxiaoguang disputing this as it's not translatable and looks off with a non english locale, which I'd agree with.

<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required placeholder="https://github.com/go-gitea/gitea.git">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and for basically every other migration which isn't plain git or github. What sense does github placeholder have for non github provider?

<input id="homeserver_url" name="homeserver_url" type="url" value="{{.MatrixHook.HomeserverURL}}" autofocus required>
<input id="homeserver_url" name="homeserver_url" type="url" value="{{.MatrixHook.HomeserverURL}}" autofocus required placeholder="https://matrix.org">
</div>
<div class="required field {{if .Err_Room}}error{{end}}">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have been removed?

@wxiaoguang wxiaoguang marked this pull request as draft April 8, 2026 23:40
<div class="required field">
<label for="room_id">{{ctx.Locale.Tr "repo.settings.matrix.room_id"}}</label>
<input id="room_id" name="room_id" type="text" value="{{.MatrixHook.Room}}" required>
<input id="room_id" name="room_id" type="text" value="{{.MatrixHook.Room}}" required placeholder="!abc:matrix.org">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just recalled this issue

matrix webhook encodes ! and # rendreing the links unusable by matrix #36012

Maybe the "bug" should be fixed first.

@qobilovvv
Copy link
Copy Markdown
Author

Could you post screen shots?

what screen shots?

@silverwind
Copy link
Copy Markdown
Member

No screenshot needed, placeholder rendering is already working in other places, so the review should focus on the content and whether the changes are exhaustive (covering all fields).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds placeholder attributes across multiple HTML templates to improve form usability/accessibility (FIXES #37069) by providing example values or guidance text for empty inputs.

Changes:

  • Add placeholders to user profile settings inputs (username, full name, bio, website, location, gravatar email).
  • Add placeholders to multiple repository webhook configuration forms (e.g., payload URLs, bot token/chat IDs, Matrix homeserver/room).
  • Add placeholders to repository fork and migrate forms, plus org/admin user edit forms.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
templates/user/settings/profile.tmpl Adds placeholders for profile settings fields (username/full name/bio/website/location/gravatar).
templates/repo/settings/webhook/wechatwork.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/telegram.tmpl Adds placeholders for bot token, chat ID, and thread ID.
templates/repo/settings/webhook/slack.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/msteams.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/matrix.tmpl Adds placeholders for homeserver and room ID (and adjusts field markup).
templates/repo/settings/webhook/gogs.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/gitea.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/feishu.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/discord.tmpl Adds an example payload URL placeholder.
templates/repo/settings/webhook/dingtalk.tmpl Adds an example payload URL placeholder.
templates/repo/pulls/fork.tmpl Adds a placeholder to the fork repo description textarea.
templates/repo/migrate/onedev.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/gogs.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/gitlab.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/github.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/gitea.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/gitbucket.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/git.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/codecommit.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/repo/migrate/codebase.tmpl Adds a clone URL placeholder to the migration clone address input.
templates/org/settings/options.tmpl Adds a placeholder for org full name.
templates/admin/user/edit.tmpl Adds a placeholder for user full name in the admin edit form.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{{/* it is rendered as markdown, but the length is limited, so at the moment we do not use the markdown editor here */}}
<label for="description">{{ctx.Locale.Tr "user.user_bio"}}</label>
<textarea id="description" name="description" rows="2" placeholder="{{ctx.Locale.Tr "settings.biography_placeholder"}}" maxlength="255">{{.SignedUser.Description}}</textarea>
<textarea id="description" name="description" rows="2" placeholder="I am a developer from San Francisco." maxlength="255">{{.SignedUser.Description}}</textarea>
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The biography placeholder was previously localized via ctx.Locale.Tr "settings.biography_placeholder"; changing it to a hardcoded English sentence makes the UI non-localized for all non-English locales. Consider keeping a translation key (reuse the existing one or add a new locale key) and translate it, instead of hardcoding English here.

Suggested change
<textarea id="description" name="description" rows="2" placeholder="I am a developer from San Francisco." maxlength="255">{{.SignedUser.Description}}</textarea>
<textarea id="description" name="description" rows="2" placeholder="{{ctx.Locale.Tr "settings.biography_placeholder"}}" maxlength="255">{{.SignedUser.Description}}</textarea>

Copilot uses AI. Check for mistakes.
<div class="field">
<label for="location">{{ctx.Locale.Tr "settings.location"}}</label>
<input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50">
<input id="location" name="location" placeholder="San Francisco, CA" value="{{.SignedUser.Location}}" maxlength="50">
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The location placeholder was previously localized via ctx.Locale.Tr "settings.location_placeholder"; switching to a hardcoded English value regresses localization for non-English users. Prefer using a locale key here (reuse the existing one or introduce a new translatable placeholder key).

Suggested change
<input id="location" name="location" placeholder="San Francisco, CA" value="{{.SignedUser.Location}}" maxlength="50">
<input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50">

Copilot uses AI. Check for mistakes.
<input id="homeserver_url" name="homeserver_url" type="url" value="{{.MatrixHook.HomeserverURL}}" autofocus required placeholder="https://matrix.org">
</div>
<div class="required field {{if .Err_Room}}error{{end}}">
<div class="required field">
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Matrix Room ID field no longer conditionally applies the error CSS class when validation fails. Since the bound form field is RoomID (see NewMatrixHookForm), the template should use {{if .Err_RoomID}}error{{end}} (similar to Err_HomeserverURL) so users get proper visual feedback on invalid input.

Suggested change
<div class="required field">
<div class="required field {{if .Err_RoomID}}error{{end}}">

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/templates This PR modifies the template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add placeholder attributes to all input and textarea elements

7 participants