Skip to content

content/msglist: Horizontal scrollbar in code block sometimes has wrong vertical position (again) #1523

@chrisbobbe

Description

@chrisbobbe

In a message-list page without a compose box, the scroll bar in a code block is misaligned, if it's in a message in the top sliver:

Bottom sliver (aligned correctly) Top sliver (bug)
Image Image

Diagnosis

This is #736 again, reappearing in fca651b; the bug is present at that commit but not its parent. We have a regression test for that issue, but it doesn't check the case where the message is in the top sliver:

    testWidgets('content not asked to consume insets (including bottom), even without compose box', (tester) async {
      // Regression test for: https://github.com/zulip/zulip-flutter/issues/736
      const fakePadding = FakeViewPadding(left: 10, top: 10, right: 10, bottom: 10);
      tester.view.viewInsets = fakePadding;
      tester.view.padding = fakePadding;

      await setupMessageListPage(tester, narrow: const CombinedFeedNarrow(),
        messages: [eg.streamMessage(content: ContentExample.codeBlockPlain.html)]);

      // Verify this message list lacks a compose box.
      // (The original bug wouldn't reproduce with a compose box present.)
      final state = MessageListPage.ancestorOf(tester.element(find.text("verb\natim")));
      check(state.composeBoxState).isNull();

      final element = tester.element(find.byType(CodeBlock));
      final padding = MediaQuery.of(element).padding;
      check(padding).equals(EdgeInsets.zero);
    });

cc @gnprice as the author of fca651b.

Metadata

Metadata

Labels

a-contentParsing and rendering Zulip HTML content, notably message contentsa-msglistThe message-list screen, except what's label:a-content

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions