From 2be785f1b6f57875a9268873de49739990bdeb19 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 12:13:15 +0000 Subject: [PATCH] Stop jumping the commit page when you tap into the reply bar Tapping the reply field used to fold the earlier commits away and mount the scroll view again at the top, to bring the commit being answered back into view. Now the page stays where it is. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 17 ----------------- .../views/native/commit-detail.blade.php | 2 +- .../native/partials/reply-field.blade.php | 7 +++---- tests/Feature/Screens/CommitDetailTest.php | 19 +++++-------------- 4 files changed, 9 insertions(+), 36 deletions(-) diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index f20c88a3..83d8c031 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -149,12 +149,6 @@ class CommitDetail extends NativeComponent */ public bool $focusReply = false; - /** - * Keys the page's scroll view. EDGE can't scroll it from PHP, so a new key - * mounts it again at the top. - */ - public int $scrollKey = 0; - /** * The replies from the last frame, so a render only builds the replies that changed, as the Log does its rows. */ @@ -259,17 +253,6 @@ public function showEarlier(): void $this->earlierShown = true; } - /** - * Tapping into the reply bar brings the commit being answered back up, under - * its parent: the earlier commits fold away again and the page starts over - * from the top. - */ - public function replyTapped(): void - { - $this->earlierShown = false; - $this->scrollKey++; - } - /** * "› N replies" under the commit opens them in place, and "Hide replies" folds them away. */ diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index c633a3d0..e788494b 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -5,7 +5,7 @@ @include('native.partials.live-stream-sheet') @include('native.partials.stargazers-sheet') - + @if (! $commit && $error === null) diff --git a/resources/views/native/partials/reply-field.blade.php b/resources/views/native/partials/reply-field.blade.php index 04f37457..3bc88b9f 100644 --- a/resources/views/native/partials/reply-field.blade.php +++ b/resources/views/native/partials/reply-field.blade.php @@ -1,11 +1,10 @@ {{-- - The reply bar's field on a commit's page (see partials/composer-plate). EDGE sends no focus event, so a press on the - field is how the page learns you're replying. The expand button is beside it rather than in it, so pressing it - doesn't count. Where the caret is goes to the page as it moves, for the "@" suggestions above the bar (see + The reply bar's field on a commit's page (see partials/composer-plate). Tapping into it leaves the page where it is. + Where the caret is goes to the page as it moves, for the "@" suggestions above the bar (see SuggestsMentions). It keeps the keyboard up through presses elsewhere on the page (keep-focus), as the Remotes field does, so picking someone to mention leaves you typing after them. --}} - + assertSee('1 reply'); }); -it('brings the commit back up under its parent when you tap into the reply bar', function () { +it('leaves the page where it is when you tap into the reply bar', function () { fakeThread(['replies_count' => 1], replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'First reply', 'author' => userJson(['handle' => 'grace', 'name' => 'Grace'])])]); $screen = Native::visit('/log/commits/c2')->tap('earlier-commits')->assertSee('The root commit'); - $before = nodeByRef($screen, 'thread-scroll')['id']; - // EDGE can't scroll from PHP, so the older ancestors fold away and the scroll view mounts again at the top. - $screen->pressUp('reply-field') - ->assertSet('earlierShown', false) - ->assertSet('scrollKey', 1) - ->assertSee('1 earlier commit') - ->assertSee('The parent commit') - ->assertDontSee('The root commit'); - - expect(childRefs($screen, 'thread-page'))->toBe(['earlier-commits', 'commit-c1', 'focused-commit', 'reply-bar-clearance']) - ->and(nodeByRef($screen, 'thread-scroll')['id'])->not->toBe($before); + // The field has nothing to do on a press: the earlier commits stay open and the scroll view isn't mounted again. + expect(nodeByRef($screen, 'reply-field')['props']['on_press_up'] ?? null)->toBeNull(); }); it('keeps the reply field the same view while the thread above it changes, so the keyboard stays up', function () { @@ -91,8 +82,8 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): $screen = Native::visit('/log/commits/c2')->tap('earlier-commits')->input('reply-input', 'Nice'); $field = idsDownTo($screen->tree(), 'reply-input'); - // Tapping into the bar, which folds the earlier commits away above it. - $screen->pressUp('reply-field')->assertDontSee('The root commit'); + // The earlier commits folding away above it. + $screen->set('earlierShown', false)->assertDontSee('The root commit'); expect(idsDownTo($screen->tree(), 'reply-input'))->toBe($field); // More of the thread drawn above it.