Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown (M3) does not scroll in fragment details view (tablet layout) #330

Open
johnjohndoe opened this issue Feb 24, 2025 · 11 comments
Open

Comments

@johnjohndoe
Copy link
Contributor

johnjohndoe commented Feb 24, 2025

Environment

  • Samsung Galaxy Tab S7 FE (SM-T733)
  • Android 14
  • com.mikepenz:multiplatform-markdown-renderer-m3:0.31.0

Context

I want to use com.mikepenz.markdown.m3.Markdown in a details view which is part of a tablet layout.

Image

Observed behavior

When I place the Markdown composable in the fragment ...

class TabletDetailsFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) =
        content {
            Screen()
        }
}

@Composable
private fun Screen() {
    Box(
        Modifier
            .verticalScroll(rememberScrollState())
    ) {
//        Text(loremIpsum)
        Markdown(loremIpsum)
    }
}

... then the text is not scrollable.

See this showcase: https://github.com/johnjohndoe/multiplatform-markdown-renderer/tree/tablet_details_scrolling

Expected behavior

The Markdown text scrolls like the androidx.compose.material3.Text text does.

@keta1
Copy link
Contributor

keta1 commented Feb 25, 2025

Screenrecorder-2025-02-25-10-51-37-890.mp4

Unable to reproduce this issue

@mikepenz
Copy link
Owner

@johnjohndoe I feel the problem might be the size of the Box it's unbound and might be larger than the screen, filling the whole space needed for the contents of the scrollable.

Can you please make sure the box matches the size of the fragment.

@keta1
Copy link
Contributor

keta1 commented Feb 25, 2025

2025-02-25.20-00-28.mp4

I tested it on the tablet and found that when the resize window, the program performed very terrible

@mikepenz
Copy link
Owner

@keta1
Copy link
Contributor

keta1 commented Feb 25, 2025

the problem with the resizing is likely due to the animation. Disabling that should handle what you see @keta1 - https://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownAnimations.kt#L29

You are right, when the animation is disabled, the twitching of the page disappears

@johnjohndoe
Copy link
Contributor Author

Indeed, configuring animations to disable them, "quick fixes" the issue:

animations = DefaultMarkdownAnimation(fun Modifier.(): Modifier = this)

@mikepenz
Copy link
Owner

For you the animation is also the problem @johnjohndoe - did you check the size of the container as well?

@johnjohndoe
Copy link
Contributor Author

Do you mean checking the heights of the box and fragment at runtime?

@mikepenz
Copy link
Owner

Yes to verify that the box itself is the size expected, as it seems like the box is larger than it should be and thus the scrolling doesn't work

@johnjohndoe
Copy link
Contributor Author

johnjohndoe commented Mar 2, 2025

I cannot see odd height values for the details_container and Box.

Image

Image

@mikepenz
Copy link
Owner

Btw. have you tested providing .verticalScroll(rememberScrollState()) directly to the Markdown composable instead of another box wrapping it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants