Skip to content

[2.x] Discussion rendering does not allow jumping to the right position #4346

@GreXXL

Description

@GreXXL

Current Behavior

Since Flarum 1.x Flarum had the weak-point of not being able to calculate sizes of certain elements in posts (such as images). This leads to the effect that if you jump to a certain post (like the last new one) you often are not at the right position as content is loaded.

Comment from @clarkwinkelmann:

The page jumping around on discussion load has become much much worse in Flarum v2. Previously this was only an issue if the posts above the viewport contained images, but now it seems almost every formatting feature (mentions, quotes, GitHub links, ...) causes a shift in the layout after the page was initially loaded.

If I find some time I'll investigate further. As things currently stand this is very annoying and I don't think this should be shipped like this. Either we need to revert back to the v1 behavior, of finally implement proper layout observer and resize so that the scroll never jumps when a post above the viewport changes height.

see also: https://discuss.flarum.org/d/38539-discuss-now-running-on-flarum-v2/68

Steps to Reproduce

Create a discussion with multiple posts that contains images for example and jump to a post below the content.

Expected Behavior

Jumping to the post always shows the right discussion

Screenshots

No response

Environment

  • Flarum version: x.y.z
  • Website URL: http://example.com
  • Webserver: [e.g. apache, nginx]
  • Hosting environment: [e.g. shared, vps]
  • PHP version: x.y.z
  • Browser: [e.g. chrome 67, safari 11]

Output of php flarum info

Output of "php flarum info", run this in terminal in your Flarum directory.

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions