Skip to content

Avoid request on same page - #152

Closed
ozguruysal wants to merge 18 commits into
hotwired:mainfrom
ozguruysal:skip-link
Closed

Avoid request on same page#152
ozguruysal wants to merge 18 commits into
hotwired:mainfrom
ozguruysal:skip-link

Conversation

@ozguruysal

Copy link
Copy Markdown
Contributor

Aims to fix the issue explained at #42 (comment).

seanpdoyle and others added 12 commits January 25, 2021 19:30
Closes hotwired#42

Navigate with a skip link within our Functional test suite, assert that
the correct element is scrolled to, the page's Location path and hash
are correct, and that the initial tab stop occurs after the skipped-to
content.
getAnchor returns an empty string for blank hashes (#) and undefined when no hash is set at all
Prevent reloading pages when tapping same-page anchors
…to_same_page_anchor

Fix navigating back to same page anchor
@seanpdoyle seanpdoyle added bug Something isn't working duplicate This issue or pull request already exists labels Apr 1, 2021
@seanpdoyle
seanpdoyle force-pushed the skip-link branch 4 times, most recently from db99401 to e92d9f8 Compare April 10, 2021 12:50
@dhh

dhh commented Jun 16, 2021

Copy link
Copy Markdown
Member

Hey @ozguruysal, I see that we didn't get this into main yet. If you're still interested pushing this forward, could you resolve the conflicts? I'll get it into main.

@ozguruysal
ozguruysal changed the base branch from skip-link to main June 20, 2021 15:13
@ozguruysal

Copy link
Copy Markdown
Contributor Author

hi @dhh I guess I managed to resolve the conflicts. I originally sent the PR to skip-link branch but looks like it's already merged so I changed the target branch to main now. Thanks for looking into this.

@ozguruysal

Copy link
Copy Markdown
Contributor Author

Not sure what's going on here but if I fix the TS error that triggers the build error it causes a conflict. If I don't fix it, no conflict but build fails. @dhh can you help fix this?

@dhh

dhh commented Jun 23, 2021

Copy link
Copy Markdown
Member

Looks like there's still a merge conflict?

@ozguruysal

Copy link
Copy Markdown
Contributor Author

Correct but fixing it causes the build to fail. See here.

@dhh

dhh commented Jun 23, 2021

Copy link
Copy Markdown
Member

Ah, I see. That error requires us to make sure that the argument is not null. Either through the TS bang method or a guard clause.

@ozguruysal

Copy link
Copy Markdown
Contributor Author

Yes, I fixed it here, but now it complains about the conflict. 😕

@marcelolx

Copy link
Copy Markdown

@ozguruysal I think the problem is that you need to rebase this branch, the commits from the print below aren't related to your changes, right?
image

@ozguruysal

ozguruysal commented Jun 23, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @marcelolx. @dhh I guess I've finally managed to fix the problems.

Edit: If this is a dirty solution, we can close this PR and I can send a clean one based off of the main branch.

@dhh

dhh commented Jun 30, 2021

Copy link
Copy Markdown
Member

This includes a different way to fix the history pop issue that I fixed in another branch. So let's at least remove that.

Don't know if @domchristie have any other observations on this that we should incorporate as well?

@domchristie

Copy link
Copy Markdown
Contributor

There's a fair bit of history on this, and I've not gone through these changes fully, but on first look I think it'd be good to reinstate the navigation tests. Also, I'm not totally sure how new native adapters interact with Turbo, but I remember having to update the turbolinks-ios adapter to be compatible with this change. I can have a closer look tomorrow.

@ozguruysal

Copy link
Copy Markdown
Contributor Author

Just let me know if you'd prefer a new PR as this is getting way too complicated. The fix I I introduced is a simple one anyways.

@dhh

dhh commented Jul 1, 2021

Copy link
Copy Markdown
Member

@ozguruysal Maybe it is easier to split this PR into a few smaller chunks.

@domchristie

Copy link
Copy Markdown
Contributor

I think main...domchristie:skip-link-2 is clean and pretty close. Just checking if there's anything else needed to add…

@dhh

dhh commented Jul 1, 2021

Copy link
Copy Markdown
Member

Would be great to get that fix in before we consider going with Turbo 7.0.0 final 👍

@dhh dhh added this to the 7.0.0 milestone Jul 1, 2021
@ozguruysal

Copy link
Copy Markdown
Contributor Author

@domchristie feel free to integrate this fix to your branch. Previously I sent the PR to your skip-link branch but it wasn't merged. It's quite related anyways.

@domchristie

Copy link
Copy Markdown
Contributor

@ozguruysal

ozguruysal commented Jul 1, 2021

Copy link
Copy Markdown
Contributor Author

I explained the issue here. Overall, I guess if the target link is an anchor on the same page, there is no point in making any request so it's logical to check that first and return false quickly.

@domchristie

Copy link
Copy Markdown
Contributor

@ozguruysal Thanks. I've added your fix here: 0e4193f.

@dhh

dhh commented Jul 1, 2021

Copy link
Copy Markdown
Member

Let's continue the work in #298.

@dhh dhh closed this Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working duplicate This issue or pull request already exists

Development

Successfully merging this pull request may close these issues.

5 participants