Comments

heacu’s picture

Title: Achore moving only if urls not the same » Anchor moving only if urls not the same
Konstantin Komelin’s picture

Status: Needs review » Needs work

Hi @brtamas,

Thank you for your patch.

I met the same problem with Advanced Forum and "Reply with quote" functionality.

Here is my case:

I have a node (node/33495) with a list of comments where "Reply with quote" links look like:
/comment/reply/33495/192200?quote=1#comment-form
This node page itself has a comment form and id="comment-form" accordingly.

The bootstrapAnchor behavior ignores the difference in urls and move my focus to the comment form instead of redirecting to the necessary comment page.

So it's definitely a bug and it should be fixed.

However, your patch doesn't work in my case because even if this.validAnchor is equal to FALSE the following code doesn't return.

if (!this.validAnchor && !$target.length) {
  return;
}

That's because it depends on the second condition which is not TRUE.
I do have id="comment-form" on the page so !$target.length is FALSE.

Thanks,
Konstantin

brtamas’s picture

I attach another page with other fixes.

And for replay:

Hi Konstantin,

Do you use bootstrap 3.0? Because as I see in this version's js the condition is formulated this way:

if (this.validAnchor && $target.length && offset > 0) {
// DO THE SCROLLING, PREVENT DEFAULT...
}

So it is the positiv way, I mean, if everything is all right to scroll to the page's another position, it does it (and prevent the default clicking).

Konstantin Komelin’s picture

Hi @brtamas,

Sure, my comment was targeted to Bootstrap 3. However, it might have been changed since my comment (3 months ago).

-- Konstantin

markhalliwell’s picture

Title: Anchor moving only if urls not the same » bootstrapAnchor does not check if URLs are different
Version: 7.x-3.0 » 7.x-3.x-dev
Component: Theme settings » Code
Category: Feature request » Bug report
Priority: Normal » Major
markhalliwell’s picture

Status: Needs work » Closed (won't fix)

Closing in favor of #2462645: Create @BootstrapPlugin for "bootstrap-anchor".

Marking as "won't fix", because any solution(s) provided here is against the current code. This will be replaced with http://markcarver.github.io/bootstrap-anchor/ instead.