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

Navigation issues on certain browsers #137

Closed
grmbyrn opened this issue Jan 17, 2025 · 0 comments · Fixed by #140
Closed

Navigation issues on certain browsers #137

grmbyrn opened this issue Jan 17, 2025 · 0 comments · Fixed by #140

Comments

@grmbyrn
Copy link
Collaborator

grmbyrn commented Jan 17, 2025

Description

Some users are experiencing issues with navigation on certain browsers. When attempting to navigate to a different page by clicking a link, the website does not update or load the new page as expected. The page remains on the current view, and the navigation action seems to be unresponsive. The issue resolves only when the user manually refreshes the page.

This behaviour is inconsistent and appears to be limited to specific browsers or browser versions, causing navigation to malfunction without refreshing.

Steps to Reproduce:

  1. Open the website in Safari, Firefox.
  2. Click on a link to navigate to a different page.
  3. The page does not change, and the current page remains active.
  4. The navigation only works after a manual page refresh.

Expected Behaviour

Clicking on a link should immediately navigate to the appropriate page without requiring a page refresh.

Actual Behaviour

The page does not change when a link is clicked, and the user remains on the current page. The issue is resolved only after refreshing the browser manually.

@josecelano josecelano linked a pull request Jan 21, 2025 that will close this issue
josecelano added a commit that referenced this issue Jan 21, 2025
50133fa fix browser issues (Graeme Byrne)

Pull request description:

  * Duplicate was being used in `data/blog-posts` and `data/index-posts.ts`. Data now stored in data/posts.ts
    * `routes/+layout.ts`, `routes/(home)/+page.server.ts` and `routes/api/+server.ts` updated to access data from correct location.
  * Text in `prevNext` component modified to reflect issue #138
  * `.md` files added to `.prettierignore` so `CodeBlock` component can be applied to all code blocks.
  * `CodeBlock.svelte` component modified as mentioned in #52. Inspiration for change came from https://www.roboleary.net/2022/01/13/copy-code-to-clipboard-blog.html?utm_source=chatgpt.com
  * In order to solve issue #137, the reliance on unsupported `startViewTransition` is removed, ensuring more consistent behavior across different browsers and preventing navigation issues.
  ```
  const supportsViewTransition = typeof window !== 'undefined' && 'startViewTransition' in document;

  onNavigate((navigation) => {
  return new Promise((resolve) => {
  if (supportsViewTransition) {
  const transition = document.startViewTransition(async () => {
  if (contentDiv) {
  contentDiv.scrollTop = 0;
  }
  resolve();
  await navigation.complete;
  });
  } else {
  if (contentDiv) {
  contentDiv.scrollTop = 0;
  }
  resolve();
  }
  });
  });
  ```
  * Overlapping `PostTable.svelte` in blog posts as mentioned in #139. The below change explicitly handles the resize event with `on:resize`, preventing conflicts between automatic binding and reactive updates, ensuring smoother state management.
  ```
  <svelte:window on:resize={() => (size = window.innerWidth)} />

  <div class={size >= 1440 ? 'scroll-container' : ''} style={divStyle}>
  <div>
  <slot />
  </div>
  </div>
  ```

ACKs for top commit:
  josecelano:
    ACK 50133fa

Tree-SHA512: 4a042cc0a98abca811b9506e08e4d1edc614f0cce36e54286606e1801960e94d1947798de740b6f0ebf3e42a75e882b42cf8a27db9bff3d4ee2da847ff963d70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant