File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 99 {{ctx.AvatarUtils.Avatar .SignedUser 40}}
1010 <div class= " ui segment content tw-my-0" >
1111 <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" >
1313 {{if .PageIsComparePull }}
1414 <div class= " title_wip_desc" data-wip-prefixes= " {{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}" >{{ctx.Locale.Tr " repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0)}}</div>
1515 {{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';
1313import { initRepoMigration } from './features/repo-migration.js' ;
1414import { initRepoProject } from './features/repo-projects.js' ;
1515import { initTableSort } from './features/tablesort.js' ;
16+ import { initAutoFocusEnd } from './features/autofocus-end.js' ;
1617import { initAdminUserListSearchForm } from './features/admin/users.js' ;
1718import { initAdminConfigs } from './features/admin/config.js' ;
1819import { initMarkupAnchors } from './markup/anchors.js' ;
@@ -122,6 +123,7 @@ onDomReady(() => {
122123 initSshKeyFormParser ( ) ;
123124 initStopwatch ( ) ;
124125 initTableSort ( ) ;
126+ initAutoFocusEnd ( ) ;
125127 initFindFileInRepo ( ) ;
126128 initCopyContent ( ) ;
127129
You can’t perform that action at this time.
0 commit comments