Skip to content

Commit f606f38

Browse files
committed
Let the back button discard the scroll offset
Contao keeps a single scroll offset that the next page consumes and clears, so it suits a listing rendered anew rather than a trip into a mask. Storing on the way out of a mask carried its position over to the listing, which then jumped to a place that means nothing there. Contao renders its own back button with discard for the same reason.
1 parent 90fa144 commit f606f38

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/DataDefinition/Definition/View/BackCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public function __construct()
3636
parent::__construct();
3737
$this->extra['class'] = 'header_back dcg';
3838
$this->extra['accesskey'] = 'b';
39-
$this->extra['attributes'] = 'data-action="contao--scroll-offset#store"';
39+
// Discard, not store, the way Contao renders its own back button. Contaos scroll offset
40+
// holds a single value that the next page consumes and clears, so it fits a listing that
41+
// renders anew - not a trip into a mask. Storing here would carry the position of the
42+
// mask over to the listing and jump to a place that means nothing there.
43+
$this->extra['attributes'] = 'data-action="contao--scroll-offset#discard"';
4044
$this
4145
->setName('back_button')
4246
->setLabel('backBT')

0 commit comments

Comments
 (0)