Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

73
Views
Links to element IDs not working in Safari + React

I am developing a simple single-page website with React.

On top of the page I have a menu bar, with links to certain parts of the page:

    <li><a href="/#about">About us</a></li>
    <li><a href="/#services">Services</a></li>
    <li><a href="/#team">Team</a></li>    

The parts of my page (not necessarily components) have the corresponding ID attribute, eg:

...
        <div id="about" className="rn-about-area ptb--120 bg_color--5">          
             ... <CONTENT>
        </div>

When a link in the menu bar gets clicked, the page should jump to the corresponding part of the page. The problem: The links are working in Chrome and Firefox, but not in Safari.

What I tried so far based on similar StackOverflow questions (that are over ten years old):

  • Omitting the / before the #anchor: <li><a href="#about">About us</a></li>
  • Defining the absolute URL path to each anchor: <li><a href="https://myURL.com/#about">About us</a></li>
  • Implementing methods like scrollTo() or scrollIntoView()
  • Wrapping the anchor-elements in React components
  • Checking for redirects that may cause problems using https://www.redirect-checker.org/index.php

but nothing works.

Is there any other way I could try? If not, my only idea is to destructure the page into seperate pages, so I can link them without using anchors.

EDIT: There might be an issue with React and the way the website is set up, because I checked a similar page, created without React, and there the first mentioned approach works, also in Safari.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It was in fact a React problem:

Using this package it finally works now!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!