Open Undistraction opened 1 year ago
@brohlson would you accept an PR for this. It's a simple fix:
const { pathname, search } = window.location
const pathnameWithSearch = `${pathname}${search}`
if (pathnameWithSearch === withPrefix(anchorPath)) {
...
}
The comparison between
window.location.pathname
will always fail if the theto
contains a query string, for example if theto
is:/example/?id=1234#foo
, the comparison will be betweenpathname
which is only/example/
and everything before the hash/example/?id=1234
, which will fail.Code here