diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index a061e7cb..479dcdcc 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -258,12 +258,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; - /** * Which of the scroll view's rows it brings into view: the commit's, once tapping another commit in the tree * moved the page to it (see refocus()), or the reply you just sent (see scrollToRow()). Null until one of those, @@ -407,18 +401,6 @@ public function showEarlier(): void $this->countAncestorReplies(); } - /** - * 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->scrollTarget = null; - $this->scrollKey++; - } - /** * A commit in the tree this page shows moves the page to it, rather than * pushing another commit page (see refocus()). Anything else opens its page. diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index a6b0a73f..e0091806 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -21,7 +21,7 @@ is keyed commit-, as the commits above it are. These need NativePHP/mobile-air#736 and NativePHP/mobile-ui#225; without them the move jumps and a repeat of the same row doesn't scroll. --}} - + @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 1879f43a..7ebff0b3 100644 --- a/resources/views/native/partials/reply-field.blade.php +++ b/resources/views/native/partials/reply-field.blade.php @@ -1,12 +1,11 @@ {{-- - The reply bar's field on a commit's page, across the top of partials/composer-box. EDGE sends no focus event, so a - press on the field is how the page learns you're replying. The tools are in the row under it, so pressing them - 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, across the top of partials/composer-box. 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. It grows with the reply to five lines and then scrolls, sized by the field itself, not by the page. --}} - + 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-scroll'))->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 () { @@ -97,8 +88,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. diff --git a/tests/Feature/Screens/PartialFramesTest.php b/tests/Feature/Screens/PartialFramesTest.php index 988742d4..9c1516a5 100644 --- a/tests/Feature/Screens/PartialFramesTest.php +++ b/tests/Feature/Screens/PartialFramesTest.php @@ -240,12 +240,9 @@ function servePartialFramePage(array $routes, string $starred): void $steps = [ 'the earlier commits shown' => fn () => $screen->call('showEarlier'), 'the replies opened' => fn () => $screen->call('toggleReplies'), - // The scroll view mounts again at the top, under a new key. - 'a tap into the reply field' => fn () => $screen->call('replyTapped'), 'a letter typed' => fn () => $screen->set('reply', 'N'), 'another' => fn () => $screen->set('reply', 'Ni'), 'the replies hidden' => fn () => $screen->call('toggleReplies'), - 'the reply field tapped again' => fn () => $screen->call('replyTapped'), 'the replies opened again' => fn () => $screen->call('toggleReplies'), // The page moves to a commit above, keeping its scroll view and the commits it shows, and back down. 'the page moved up' => fn () => $screen->call('openCommit', 'c1')->assertSet('id', 'c1'),