Description
Which component is affected?
Qwik Runtime
Describe the bug
Issue Overview
This report outlines an observed inconsistency in the behavior of the <a>
and Qwik Link
elements when used for scrolling to a target element in a Qwik application. The behavior varies between local and Stackblitz environments, and also changes after a routeAction$
is invoked upon form submission.
<a>
Element Behavior
The <a>
element initially performs as expected, scrolling to the target element and opening the details
element that contains the target when clicked. However, after a routeAction$
is triggered upon form submission, subsequent clicks on the <a>
element have no effect. This behavior is consistent in both local and Stackblitz environments.
Qwik Link
Element Behavior
The behavior of the Qwik Link
element differs significantly between local and Stackblitz environments. In a local environment, the Link
element, despite having the same href as the <a>
element, does not respond to clicks even before form submission. Conversely, in the Stackblitz environment, the Link
element functions as expected both before and after form submission.
Reproduction Steps
Both the local and Stackblitz applications share the same codebase, including the package.json
. Detailed instructions for reproducing the issue are provided on-screen in both applications.
Reproduction
https://github.com/Sport-Thieme/qwik-scroll-issue
Steps to reproduce
Qwik Scroll Issue Demo
This repository contains a demo for the Qwik scroll issue. Follow the instructions below to clone and start the repository:
Cloning the Repository
-
Open a terminal.
-
Navigate to the directory where you want to clone the repository.
-
Run the following command:
git clone https://github.com/Sport-Thieme/qwik-scroll-issue
Starting the Repository
-
Navigate into the cloned repository's directory:
cd qwik-scroll-issue
-
Install the dependencies:
npm install
-
Start the application:
npm start
The application should now be running at http://localhost:5173
.
Issue Description
This repository demonstrates an unexpected behavior in Qwik related to the <a>
element and the Qwik Link
element when used for scrolling to an element with a specific id.
<a>
Element Behavior
The <a>
element behaves as expected, scrolling to the target element and opening the details
element that contains the target when clicked, until a routeAction$
is called upon form submission. After the form submission, clicking on the <a>
element has no effect. This behavior is consistent both when running the application locally and on Stackblitz.
Qwik Link
Element Behavior
The behavior of the Qwik Link
element differs between running the application locally and on Stackblitz.
Local Environment
In a local environment, the Link
element neither scrolls to the target element nor opens the details
element, even before form submission.
Stackblitz Environment
On Stackblitz, the Link
element behaves as expected, both before and after form submission. It scrolls to the target element and opens the details
element when clicked.
Testing the Issue
Detailed instructions on how to test this issue will be displayed on the screen when you run the application.
System Info
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 138.08 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v18.17.1/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
pnpm: 9.0.5 - ~/.nvm/versions/node/v18.17.1/bin/pnpm
Browsers:
Chrome: 124.0.6367.92
Safari: 17.4.1
npmPackages:
@builder.io/qwik: ^1.5.2 => 1.5.2
@builder.io/qwik-city: ^1.5.2 => 1.5.2
undici: * => 6.15.0
vite: ^5.1.6 => 5.2.10
Additional Information
Please, make sure to check the behaviour both on Stackblitz and by running the app locally after cloning it.