When google translator is place in the footer of a website, all pages (with the footer) automatically scrolls to the bottom upon page load or refresh.

It may have something to do with tab-indexing of the form elements, or some other attribute?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

utcbrij created an issue. See original summary.

ethant made their first commit to this issue’s fork.

ethant’s picture

I think this is related / the same as the bug I am seeing where a page bounces to the top when the widget is in the header of the site after visiting a page anchor. Adding a patch.

gauravjeet changed the visibility of the branch 3496864-google-translator-in to hidden.

gauravjeet changed the visibility of the branch 3496864-google-translator-in to active.

gauravjeet’s picture

This MR by ethant seems to fix the scrolling issue - https://git.drupalcode.org/project/google_translator/-/merge_requests/9

jenna.tollerson’s picture

Status: Active » Needs work

1. I don't understand why all the javascript needs to be rewritten to fix this bug. If the javascript needs to be modernized, that seems like a separate issue. If there's something rewriting the entire file fixes that I can't see, please explain.
2. Removing window.setTimeout(() => gadget.focus(), 500); may fix this bug, but it's a step backwards for accessibility. That line is there to to fix an issue with accessibility for users that navigate the site via keyboard. We must give the focus to the loaded widget so they don't lose their place in the page. Otherwise they have to tab back to it.

  • jenna.tollerson committed 69987551 on 2.x
    fix: #3496864 Google Translator in the footer forces the page to scroll...
jenna.tollerson’s picture

Status: Needs work » Needs review

I would appreciate feedback on whether the newest commit fixes this issue for folks.

amitsharma27sept’s picture

Looks ok to me and working

amitsharma27sept’s picture

By when this can be released? It is creating accessibility issue for us.

jenna.tollerson’s picture

Are we calling this RTBC? It's been pretty quiet.

amitsharma27sept’s picture

Status: Needs review » Reviewed & tested by the community

I tested and confirm that change resolves the issue of moving to top on page load.
This also resolves the page scrolling to top if page is not scrolling to ids on the page if loaded with # links.

Thak you for your work on this.

jenna.tollerson’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for testing. :)

Fixed in 2.3.1

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

amitsharma27sept’s picture

Hi,

I checked this again after update, it looks like this does not fix for users who are vising the page first time with # in url. If they use any element with in page id with #, and coming on website first time (i.e. googtrans cookie is not set), it force focus on translator dropdown and hence loosing the context of accessing url with '#'.

Can we also put some check to not force focus on translator dropdown by checking "location.hash" ?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.