mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Allow opt-out of autofocus in CMS editor form, to avoid browser "auto scrolling" to bring the focused element into view (fixes #7242)
This commit is contained in:
parent
8c1053968c
commit
e29bb3c390
@ -64,8 +64,11 @@
|
||||
// in order to avoid changing the menu state if the action is cancelled by the user
|
||||
// $('.cms-menu')
|
||||
|
||||
// focus input on first form element
|
||||
this.find(':input:visible:not(:submit):first').focus();
|
||||
// focus input on first form element. Exclude elements which
|
||||
// specifically opt-out of this behaviour via "data-skip-autofocus".
|
||||
// This opt-out is useful if the first visible field is shown far down a scrollable area,
|
||||
// for example for the pagination input field after a long GridField listing.
|
||||
this.find(':input:visible:not(:submit)[data-skip-autofocus!="true"]:first').focus();
|
||||
|
||||
// Optionally get the form attributes from embedded fields, see Form->formHtmlContent()
|
||||
for(var overrideAttr in {'action':true,'method':true,'enctype':true,'name':true}) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<tr>
|
||||
<td class="bottom-all" colspan="$Colspan">
|
||||
<div class="datagrid-pagination">
|
||||
$FirstPage $PreviousPage <span class="pagination-page-number">Page <input class="text" value="$CurrentPageNum"/> of $NumPages</span> $NextPage $LastPage
|
||||
$FirstPage $PreviousPage <span class="pagination-page-number">Page <input class="text" value="$CurrentPageNum" data-skip-autofocus="true" /> of $NumPages</span> $NextPage $LastPage
|
||||
</div>
|
||||
|
||||
<span class="pagination-records-number">View $FirstShownRecord - $LastShownRecord of $NumRecords</span>
|
||||
|
Loading…
Reference in New Issue
Block a user