I'm experiencing a strange issue where <a>
anchors for external links do not behave as expected for mobile viewports in my React App. Clicking an external link initially works fine on mobile, launching a new tab, however subsequent link clicks on the same, or other <a>
elements results in nothing happening.
This is odd because this works fine and as expected on desktop and larger viewports.
Here's a snippet example of how I'm using an anchor in a component:
import React from "react";
import Col from "react-bootstrap/Col";
import Row from "react-bootstrap/Row";
function ProjectExample() {
return (
<div>
<Row className="project-row">
<Col>
<h3>Foo Bar</h3>
<p>
See my project here: <a href="https://github.com" target="_new">GitHub</a>.
</p>
</Col>
</Row>
</div>
);
}
export default ProjectExample;
Seems pretty basic right? Does anyone have any insight into why external link behavior would result in successive clicks on mobile not firing? This project is bare bones in the sense, for internal navigation I only am using react-scroll
to scroll about the page similar to page anchors. I'm not utilizing react-router-dom
or any other form of navigation. These links are purely to external sites and don't have any click events etc associated with them.
Is there something basic I'm overlooking?
Summary
External links are used in my app as standard html <a>
anchor elements. These point to external sites, and work fine on desktop/laptop larger viewports, however for mobile, only an initial link click will open a new tab -- successive and additional link clicks (or even the same link) will not fire (e.g, nothing happens). What am I doing wrong?