File tree 3 files changed +9
-1
lines changed 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 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}}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {initImageDiff} from './features/imagediff.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,6 +123,7 @@ onDomReady(() => {
122
123
initSshKeyFormParser ( ) ;
123
124
initStopwatch ( ) ;
124
125
initTableSort ( ) ;
126
+ initAutoFocusEnd ( ) ;
125
127
initFindFileInRepo ( ) ;
126
128
initCopyContent ( ) ;
127
129
You can’t perform that action at this time.
0 commit comments