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

Table display “flickers” when refreshing the page #7219

Closed
4 tasks done
syxc opened this issue May 28, 2024 · 9 comments
Closed
4 tasks done

Table display “flickers” when refreshing the page #7219

syxc opened this issue May 28, 2024 · 9 comments
Labels
blocked Issue is blocked by another issue upstream Issue must be taken upstream

Comments

@syxc
Copy link

syxc commented May 28, 2024

Context

No response

Bug description

Table display “flickers” when refreshing the page.

Kapture.2024-05-28.at.21.16.45.mp4

Related links

Reproduction

mkdocs-demo.zip

Steps to reproduce

refreshing page

Browser

Chrome, Safari, Edge, Firefox

Before submitting

@alexvoss
Copy link
Sponsor Collaborator

Thanks for reporting. You could help us figure out what is going on by removing things from your projects that are not needed to reproduce the effect. The minimal reproduction page suggests starting from the other end by producing a new project and then adding things in until the effect is observed.

@syxc
Copy link
Author

syxc commented May 28, 2024

Thanks for reporting. You could help us figure out what is going on by removing things from your projects that are not needed to reproduce the effect. The minimal reproduction page suggests starting from the other end by producing a new project and then adding things in until the effect is observed.

@alexvoss

Hi, Clean demo updated.

mkdocs-demo-modified.zip

@alexvoss
Copy link
Sponsor Collaborator

I don't observe the flickering in Firefox but I can see it in Chrome and Safari. It also seems to be worse when the Developer Tools are open. Not entirely sure this is caused by Material?

Btw,. please follow the instructions for the minimal reproduction as the info plugin also records the version number of Material used and runs various checks.

@syxc
Copy link
Author

syxc commented May 28, 2024

I don't observe the flickering in Firefox but I can see it in Chrome and Safari. It also seems to be worse when the Developer Tools are open. Not entirely sure this is caused by Material?

Btw,. please follow the instructions for the minimal reproduction as the info plugin also records the version number of Material used and runs various checks.

@alexvoss

Sorry, Firefox I didn't test it carefully, I just confirmed it and it does look fine on Firefox.
The demo I've updated is actually quite clean, just these few files, the dependencies are only the latest version of mkdocs-material, mkdocs.yml only adds the most basic configuration, and runtime.txt can be ignored.

Looking forward to your fixed version.

1716909665157

@syxc
Copy link
Author

syxc commented May 28, 2024

Retried it, and this problem I fed back exists on Chrome, Safari.

image
@syxc
Copy link
Author

syxc commented May 28, 2024

Sorry, just confirmed, this issue doesn't seem to be a problem with mkdocs-material, I found that the tables extension for mkdocs also has the problem I reported.

@squidfunk
Copy link
Owner

Thanks for reporting. The slight repositioning comes from the fixes that Material for MkDocs has to apply in the browser to make tables properly scrollable, which is implemented in JavaScript. If you turn JavaScript off in your browser, you can see that the jittering stops. It could be fixed, if and only if the tables extension would create the necessary markup from the start.

Providing a wrapper element should be easy to implement in the tables extension – I recommend raising this as a potential feature request to Python Markdown, in order to allow for improving mobile user experience:

<div class="table">
  <div class="table-wrapper">
    ...
  </div>
</div>

The extension could hide it behind a feature flag, so it's downward compatible:

markdown_extensions:
  - tables:
      use_wrapper: true

This is what Material for MkDocs currently needs to do:

/**
* Render a table inside a wrapper to improve scrolling on mobile
*
* @param table - Table element
*
* @returns Element
*/
export function renderTable(table: HTMLElement): HTMLElement {
return (
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table">
{table}
</div>
</div>
)
}

Without this fix, large tables would break the layout on mobile and overflow.

@squidfunk squidfunk added blocked Issue is blocked by another issue upstream Issue must be taken upstream labels May 29, 2024
@syxc
Copy link
Author

syxc commented May 29, 2024

I retried it and found something, I recorded a video that you can watch, hopefully it will help with the mkdocs-material improvements.

mkdocs-demo-20240529.zip

Kapture.2024-05-29.at.19.58.09.mp4
@squidfunk
Copy link
Owner

Thanks for sharing! We'll check it out ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Issue is blocked by another issue upstream Issue must be taken upstream
3 participants