ICEfaces
  1. ICEfaces
  2. ICE-8314

ace:menuItem - Clicking on menuItem resets browser scroll positon in IE7

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.0.0.GA, 3.1.0.BETA2
    • Fix Version/s: 3.1, EE-3.0.0.GA_P01
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 3.1.0 BETA2 062812, IE9 Compat Mode, IE8 Compat Mode, IE7 Standards
    • Assignee Priority:
      P3

      Description

      When clicking on a menuItem in IE and the browser is scrolled down, it will reset/move the browser scroll to the top of the page.

      This only occurs when running IE with the IE7 Standards mode. It also only occurs when the ace:ajax render attribute is set to @all or @form. If set to @this or a specific component this does not occur. This also only seems to affect the menuBar/menuItem components. Using the same code for the ace:pushButton does not cause the issue.

      Other observations:
       - When running in IE9 Compat/IE7 Standars, the following warning is displayed in the console: SEC7115: :visited and :link styles can only differ by color. Some styles were not applied to :visited.
       - If a full refresh is done after the page is loaded this issue is no longer seen.

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows the issue.

        Steps:

        • Load welcomeICEfaces.jsf in an IE browser.
        • Scroll the browser down the page.
        • Click on "Menu One" menuItem. Issue does not happen now.
        • Click on "Menu One" menuItem again, browser scroll position is now sent to the top of the page.
        Show
        Arran Mccullough added a comment - Attached test case that shows the issue. Steps: Load welcomeICEfaces.jsf in an IE browser. Scroll the browser down the page. Click on "Menu One" menuItem. Issue does not happen now. Click on "Menu One" menuItem again, browser scroll position is now sent to the top of the page.
        Hide
        yip.ng added a comment - - edited

        Browser scrolling is caused by the dummy href attribute: href="#". See screenshot-01.png. We have made this same mistake many times before in 1.8 in both components and showcase. This will cause some browsers to reload page or reposition to top of page. Should use href="javascript:void 0;" See "JavaScript: The Definitive Guide", by David Flanagan, 6th Ed., section 13.2.5. But even this a long outdated hack. As the author suggests, "The link above would be better expressed as an onclick handler on a <button> element." Either that or we should avoid the onclick attribute altogether and use pure jQuery JS. Either way it would require fundamental changes to the component.

        Modified: C:\svn\ossrepo\icefaces3\trunk\icefaces\ace\component\src\org\icefaces\ace\component\menu\BaseMenuRenderer.java
        Completed: At revision: 29813

        SEC7115 is triggered by the IE9 Tracking Protection mechanism. It is just a harmless warning seen only in developer tools console. Google it for all the tedious details. Leave it unless we want to use the lowest common denominator for the link and visited states CSS and spend the time to ferret out all the possible scenarios that the link and visited states might change.

        Show
        yip.ng added a comment - - edited Browser scrolling is caused by the dummy href attribute: href="#". See screenshot-01.png. We have made this same mistake many times before in 1.8 in both components and showcase. This will cause some browsers to reload page or reposition to top of page. Should use href="javascript:void 0;" See "JavaScript: The Definitive Guide", by David Flanagan, 6th Ed., section 13.2.5. But even this a long outdated hack. As the author suggests, "The link above would be better expressed as an onclick handler on a <button> element." Either that or we should avoid the onclick attribute altogether and use pure jQuery JS. Either way it would require fundamental changes to the component. Modified: C:\svn\ossrepo\icefaces3\trunk\icefaces\ace\component\src\org\icefaces\ace\component\menu\BaseMenuRenderer.java Completed: At revision: 29813 SEC7115 is triggered by the IE9 Tracking Protection mechanism. It is just a harmless warning seen only in developer tools console. Google it for all the tedious details. Leave it unless we want to use the lowest common denominator for the link and visited states CSS and spend the time to ferret out all the possible scenarios that the link and visited states might change.
        Hide
        yip.ng added a comment -

        Done.

        Modified: C:\svn\ossrepo\icefaces3\branches\icefaces-3.0.x-maintenance\icefaces\ace\component\src\org\icefaces\ace\component\menu\BaseMenuRenderer.java
        Completed: At revision: 29849

        Show
        yip.ng added a comment - Done. Modified: C:\svn\ossrepo\icefaces3\branches\icefaces-3.0.x-maintenance\icefaces\ace\component\src\org\icefaces\ace\component\menu\BaseMenuRenderer.java Completed: At revision: 29849

          People

          • Assignee:
            yip.ng
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: