loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

When the title in the issue has a value, set the text cursor at the end of the text. (#30090)

Fix: [#25055](https://github.com/go-gitea/gitea/issues/25055)

Before

![image](https://github.com/go-gitea/gitea/assets/37935145/1b89cd7b-4fa3-49aa-9b5e-a8413add436e)

After

![image](https://github.com/go-gitea/gitea/assets/37935145/fa808f8d-d3ce-4245-a4fe-dd0282ba3fdf)

ps: I've noticed that we are gradually replacing jQuery, so I didn't use jQuery here.
(cherry picked from commit 1261dd6742fb7095e51c173ca4641477d81a3634)

authored by

HEREYUA and committed by
Earl Warren
8c2559a7 fa87a57b

+9 -1
+1 -1
templates/repo/issue/new_form.tmpl
··· 9 9 {{ctx.AvatarUtils.Avatar .SignedUser 40}} 10 10 <div class="ui segment content tw-my-0"> 11 11 <div class="field"> 12 - <input name="title" id="issue_title" placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" autofocus required maxlength="255" autocomplete="off"> 12 + <input name="title" class="js-autofocus-end" id="issue_title" placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" required maxlength="255" autocomplete="off"> 13 13 {{if .PageIsComparePull}} 14 14 <div class="title_wip_desc" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}">{{ctx.Locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0)}}</div> 15 15 {{end}}
+6
web_src/js/features/autofocus-end.js
··· 1 + export function initAutoFocusEnd() { 2 + for (const el of document.querySelectorAll('.js-autofocus-end')) { 3 + el.focus(); // expects only one such element on one page. If there are many, then the last one gets the focus. 4 + el.setSelectionRange(el.value.length, el.value.length); 5 + } 6 + }
+2
web_src/js/index.js
··· 13 13 import {initRepoMigration} from './features/repo-migration.js'; 14 14 import {initRepoProject} from './features/repo-projects.js'; 15 15 import {initTableSort} from './features/tablesort.js'; 16 + import {initAutoFocusEnd} from './features/autofocus-end.js'; 16 17 import {initAdminUserListSearchForm} from './features/admin/users.js'; 17 18 import {initAdminConfigs} from './features/admin/config.js'; 18 19 import {initMarkupAnchors} from './markup/anchors.js'; ··· 122 123 initSshKeyFormParser(); 123 124 initStopwatch(); 124 125 initTableSort(); 126 + initAutoFocusEnd(); 125 127 initFindFileInRepo(); 126 128 initCopyContent(); 127 129