Firefox scroll issue

9 posts, 0 answers
  1. Dennis
    Dennis avatar
    9 posts
    Member since:
    Nov 2008

    Posted 02 Dec 2008 Link to this post

    We are using version 2008.3.1105.35.  I have a page that uses a asp:gridview which contains a link to open a rad window.  The grid is long and requires vertically scrolling.  The rad window used to open at the top of the page and have the background disabled.  Now the window opens at the scrolled position and causes firefox to scroll up so you can only see the top of the modal window.  This seems to only happen in firefox.  Any ideas?

    Thanks
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 04 Dec 2008 Link to this post

    Hello Dennis,

    At this point I cannot tell what the reason for the problem might be as I cannot reproduce it locally. Could you please open a support ticket and send me a small sample project where this behavior could be reproduced? I will check it right away.



    All the best,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Dennis
    Dennis avatar
    9 posts
    Member since:
    Nov 2008

    Posted 04 Dec 2008 Link to this post

    I went to make a sample and I cannot reproduce it.  The current project that has it in it is quite large and uses many css position attributes.  Is it possible that my css floats and position attributes have affected the rad window?
  4. Dennis
    Dennis avatar
    9 posts
    Member since:
    Nov 2008

    Posted 04 Dec 2008 Link to this post

    I also noticed, when the radwindow initially pops up, for a split second, the form elements contain data from the last time the radwindow was shown.  Then when it repopulates the elements in the pages page_load event (of the radwindow) is when the window scrolls that you can no longer see the entire rad window.
  5. Dennis
    Dennis avatar
    9 posts
    Member since:
    Nov 2008

    Posted 04 Dec 2008 Link to this post

    I found the issue, I don't think its related to RadWindow at all, but I'll post it anyway.  On my radwindow page, I have a server side controlName.focus() - this apparently causes the browser to scroll to the spot where the focused control is near the bottom of the page.  This must be some sort of a firefox bug.  Any thoughts?
  6. Dennis
    Dennis avatar
    9 posts
    Member since:
    Nov 2008

    Posted 04 Dec 2008 Link to this post

    It appears that using the server controls .focus method gets executed before the page is fully rendered in firefox (firefox tries to adjust the screen based on what has focus I think).  I ended up setting the focus using a Me.Page.ClientScript.RegisterStartupScript which solved the problem.

    Thanks!
  7. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 05 Dec 2008 Link to this post

    Hello Dennis,

    We are glad you got the issue resolved. Indeed, for some reason unknown the MS implementation of the <serverControl>.Focus() method comes down to injecting a simple client-side script on the page that will indeed set focus to the element. So far, so good. There is a serious shortcoming however when a developer is using MS AJAX based controls - the "focus" script executes right away where it is injected - and that is before the page has even fully loaded, and before the window.onload event that causes MS AJAX page initialization is triggered.

    Thus, as a result such problems occur. If the "focus" script was properly inserted to execute after the page has loaded, all would be fine. We are not sure why the Focus methon in the ASP.NET framework is implemented in such a manner, but the only reasonable workaround is the one you found - to use RegisterStartupScript  to set focus.


    Best regards,
    Tervel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Scott Davis
    Scott Davis avatar
    10 posts
    Member since:
    Apr 2010

    Posted 25 Oct 2011 Link to this post

    This is a really old thread, but it does seem to apply to an issue I am currently having.

    I have a scenario where I am using a RadGrid to display a long list of items, enough so that the user would have to scroll down to see some of the items.  On each item, the user can click a link which opens a RadWindow for editing the item.  All of this works fine.

    However, like the original poster for this thread, if the page that is being opened in the RadWindow calls a control.focus() method it causes the page to scroll all the way back to the top.  The RadWindow is opened at the location where the item in the grid was clicked, so depending on how far you scrolled down before you clicked to open an item you might not even be able to see the RadWindow at all without scrolling down again.

    I have tried eliminating the control.focus() call and have replaced it with a RegisterStartupScript call as prescribed here.  However, that causes the exact same behavior.  Here is the RegisterStartupScript call

    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "setFcs", string.Format("document.forms[0]['{0}'].focus();", txtLastName.ClientID), true);


    Any ideas?  I am testing this in Internet Explorer 9.
  9. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4627 posts

    Posted 27 Oct 2011 Link to this post

    Hello Scott,

    We have seen similar behavior when focus() is called and usually adding a small timeout resolves the situation, for example try:
    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "setFcs", string.Format("setTimeout(function(){document.forms[0]['{0}'].focus();},0);", txtLastName.ClientID), true);

    I hope this will help. Usually such a timeout is needed to allow the browser to finish a previous operation that is needed for the current one, so it may also help here.

    Regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top