Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me when going to https://keystatic-site-6sga3atq0-thinkmill-labs.vercel.app/#mailing-list this still doesn't work, although when a try on localhost:3000/#mailing-list it does (the first time)
It's strange, because https://keystatic-site-6sga3atq0-thinkmill-labs.vercel.app/docs/collections-and-singletons#singletons for example seem to work as intended 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is something to do with the absolute positioning or hidden classes. 🤔
Any reason we shouldn't just wrap the
h2
with an anchor? Offset is the only reason I can think ofThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, the way I tested was to go to https://keystatic-site-6sga3atq0-thinkmill-labs.vercel.app and modify the url to add
/#mailing-list
. This worked. Refreshing from that point also worked. What I didn't test was scrolling back to the top of the page and then refreshing. That doesn't work. Or building the link and clicking on it from an external source.If you have the element in the viewport, then all good, refresh works. Even if you have the element near the viewport it will at least attempt a scroll. The same process (url mod, refresh at different scroll points) works for keystatic.com 😅
This also has the same result.
Short of a custom hook, I think the best options are:
/mailing-list
page to hold that component that we link to from the README and other external sourcesIt's only partly broken, you are at least taken to the correct page when you click on the
/#mailing-list
link.Open to thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer it not to be broken at all.
This problem is actually a bit deeper than we thought. I couldn't understand why this wasn't working as it is standard browser behaviour, was NextJS overriding the browser behaviour? Why was it working on our other docs pages but not this one?
Turns out this is an issue with our homepage. Unlike the doc content pages where this works, the homepage isn't being server rendered at all. When viewing the source none of the homepage markup is there, so we need to fix that first.
I'll take a look.