diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 058ea8d73..88a6c39e5 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -9,7 +9,7 @@ {{ctx.AvatarUtils.Avatar .SignedUser 40}}
- + {{if .PageIsComparePull}}
{{ctx.Locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0)}}
{{end}} diff --git a/web_src/js/features/autofocus-end.js b/web_src/js/features/autofocus-end.js new file mode 100644 index 000000000..da71ce953 --- /dev/null +++ b/web_src/js/features/autofocus-end.js @@ -0,0 +1,6 @@ +export function initAutoFocusEnd() { + for (const el of document.querySelectorAll('.js-autofocus-end')) { + el.focus(); // expects only one such element on one page. If there are many, then the last one gets the focus. + el.setSelectionRange(el.value.length, el.value.length); + } +} diff --git a/web_src/js/index.js b/web_src/js/index.js index abf0d469d..4c707486b 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -13,6 +13,7 @@ import {initImageDiff} from './features/imagediff.js'; import {initRepoMigration} from './features/repo-migration.js'; import {initRepoProject} from './features/repo-projects.js'; import {initTableSort} from './features/tablesort.js'; +import {initAutoFocusEnd} from './features/autofocus-end.js'; import {initAdminUserListSearchForm} from './features/admin/users.js'; import {initAdminConfigs} from './features/admin/config.js'; import {initMarkupAnchors} from './markup/anchors.js'; @@ -122,6 +123,7 @@ onDomReady(() => { initSshKeyFormParser(); initStopwatch(); initTableSort(); + initAutoFocusEnd(); initFindFileInRepo(); initCopyContent();