hivdb / chiro-frontend

Coronavirus frontend, CoV-Rx-DB,
0 stars 1 forks source link

susceptibility-data page auto scroll down #21

Closed KaimingTao closed 2 years ago

KaimingTao commented 2 years ago

https://covdb.stanford.edu/page/susceptibility-data/

philiptzou commented 2 years ago

This issue is caused by malformed markdown text stored in hivdb/chiro-cms:

https://github.com/hivdb/chiro-cms/blob/fac5fd36eec78f0174a309a86525e9aea8a51393/pages/page-susceptibility-data.yml#L118-L120

Markdown text:

CP
Studies
#

After parsing, the HTML looks like:

CP
Studies
<h1 id=""></h1>

The previous version of <HeadingTag> from sierra-frontend checked if current hash string matches the id of any heading tags. The hash string of https://covdb.stanford.edu/page/susceptibility-data/ is empty (""), it matches the malformed <h1> tag created by Markdown. The component then scroll the screen to the <h1> tag.

An additional condition is added to <HeadingTag> to skip scrolling when hash string is empty (hivdb/sierra-frontend@c0b248c).

A fix commit of hivdb/chiro-cms will be submitted soon.

philiptzou commented 2 years ago

The page didn't scroll only until the second access was due to the another closely related bug fixed by hivdb/sierra-frontend@04c55cc. It didn't use Markdown to render column labels until the page was accessed again.