关于IE7的IceFaces menuBar + menuItem显示错误

时间:2011-12-13 16:13:49

标签: css jsf-2 position absolute icefaces-2

寻找一些小显示错误的帮助。以下是使用IceFaces 2.0.2在JBoss 7.0.2.Final上运行的代码示例:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TEST</title>
<style>
  *{margin: 0;padding: 0;font-family: Helvetica, Arial, Verdana ;font-size: 12px;}
  .mainmenubar{width: 100%;height: 32px;background-color: blue;}
  .mainmenubarItem{float: left;height: 27px;border-right: 1px solid white;padding-top: 5px;}
  .mainmenubarItem a, .mainmenubarItem a:hover, .mainmenubarItem a span{color: white;font-size: 16px;font-weight: bold;text-decoration: none;}
  .mainmenubarSubMenu{position: absolute;background-color: #F5F5F5;}
  </style>
</h:head>
<h:body>
  <div style="background-color: grey; width: 100%; height: 50px;" />
    <ice:form id="menuform">
      <ice:menuBar styleClass="mainmenubar" orientation="horizontal">
        <ice:menuItem styleClass="mainmenuitem" id="mainmenu1" onclick="return false;" value="MENU1">
          <ice:menuItem value="SUBMENU1" styleClass="submenuitem" id="submenu1" onclick="return false;" />
          <ice:menuItem value="SUBMENU1" styleClass="submenuitem" id="submenu2" onclick="return false;" />
        </ice:menuItem>
        <ice:menuItem styleClass="mainmenuitem" id="mainmenu2" onclick="return false;" value="MENU2" />
      </ice:menuBar>
    </ice:form>
  <div class="bottom" style="background-color: yellow; width: 100%; height: 1800px;" />
</h:body>
</html>

似乎我无法直接上传附在此帖子上的文件来显示截图。但是,您应该能够将此代码复制/粘贴到具有类似配置的任何IceFaces项目中,打开IE7版本(事实上我确实使用IE8激活了“兼容性视图”模式,想知道它是否有效果。)

如果您不滚动页面并将MENU1悬停,您将看到SUBMENU正确显示。但是,如果您滚动一点页面以使菜单位于页面顶部并将菜单悬停在菜单上,您将看到SUBMENU在菜单下显示约50px。因此,你永远无法点击第二个菜单...

无法弄清楚为什么这不起作用。我看了http://component-showcase.icefaces.org/component-showcase/showcase.iface上的IceFaces展示,看到它在我的IE版本上工作(真的不能证明展示使用与我相同版本的IceFaces)。

我做了一个额外的测试:在本地获取展示代码显示相同的行为(有bug)。这是我正在运行的确切代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TEST</title>
<link rel="stylesheet" type="text/css" href="http://component-showcase.icefaces.org/component-showcase/xmlhttp/css/rime/rime.css" />
<link rel="stylesheet" type="text/css" href="http://component-showcase.icefaces.org/component-showcase/css/showcase_style.css" />
<link rel="stylesheet" type="text/css" href="http://component-showcase.icefaces.org/component-showcase/css/showcase_overrides.css" />
<link rel="stylesheet" type="text/css" href="http://component-showcase.icefaces.org/component-showcase/css/showcase_layout.css" />
</h:head>
<h:body>
   <ice:panelGroup styleClass="componentBox">

     <ice:panelGroup styleClass="synopsisBox menuBarContainer">
       <ice:outputText value="The menuBar component provides a robust menu system." />
       <ice:outputText value="In the box below, choose the orientation of the Menu Bar and then select a menu item. The backing been value of the selected item will be reflected under Server-side Backing Bean Values." />
     </ice:panelGroup>

     <ice:panelGroup styleClass="clearer" />

     <!-- main menu declaration  -->
     <ice:panelGroup styleClass="exampleBox menuBarContainer">
       <ice:menuBar id="menuBar" orientation="horizontal">
         <!-- File menu -->
         <ice:menuItem value="File" id="file" onclick="return false;">
           <ice:menuItem onclick="return false;" id="open" value="Open" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/open.gif"></ice:menuItem>
           <ice:menuItem id="close" value="Close" onclick="return false;"></ice:menuItem>
           <ice:menuItem id="recent" value="Recent" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/recent.gif" onclick="return false;">
             <ice:menuItem id="file1" value="File 1" onclick="return false;"></ice:menuItem>
            <ice:menuItem id="file2" onclick="return false;" value="File 2">
            <ice:menuItem id="para1" onclick="return false;" value="Para 1"></ice:menuItem>
              <ice:menuItem id="para2" value="Para 2" onclick="return false;"></ice:menuItem>
              <ice:menuItem id="para3" value="Para 3" onclick="return false;"></ice:menuItem>
            </ice:menuItem>
            <ice:menuItem value="File 3" id="file3" onclick="return false;"></ice:menuItem>
            <ice:menuItem value="File 4" id="file4" onclick="return false;"></ice:menuItem>
          </ice:menuItem>

          <ice:menuItem id="save" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/save.gif" value="Save" onclick="return false;"></ice:menuItem>
          <ice:menuItemSeparator />
          <ice:menuItem id="print" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/print.gif" value="Print" onclick="return false;"></ice:menuItem>

        </ice:menuItem>

        <!-- Edit menu -->
        <ice:menuItem value="Edit" id="edit" onclick="return false;">
          <ice:menuItem id="cut" value="Cut" onclick="return false;"></ice:menuItem>
          <ice:menuItem id="copy" value="Copy" onclick="return false;"></ice:menuItem>
          <ice:menuItem id="paste" value="Paste" onclick="return false;"></ice:menuItem>
        </ice:menuItem>

        <!-- View menu -->
        <ice:menuItem value="View" id="view" onclick="return false;">
          <ice:menuItem id="zoom_in" value="Zoom In" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/zoomin.gif" onclick="return false;"></ice:menuItem>
          <ice:menuItem id="zoom_out" value="Zoom Out" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/zoomout.gif" onclick="return false;"></ice:menuItem>
          <ice:menuItem id="fit_in_window" value="Fit In Window" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/fitinwindow.gif" onclick="return false;"></ice:menuItem>
          <ice:menuItem id="actual_size" value="Actual Size" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/actualsize.gif" onclick="return false;"></ice:menuItem>
        </ice:menuItem>

        <!-- Help Menu -->
        <ice:menuItem value="Help" id="help" onclick="return false;">
          <ice:menuItem id="docs" value="Documentation" icon="http://component-showcase.icefaces.org/component-showcase/images/menu/help.gif" link="http://www.icefaces.org/main/resources/documentation.iface" target="_blank" />
        </ice:menuItem>

      </ice:menuBar>
    </ice:panelGroup>

    <ice:panelGroup styleClass="clearer" />

  </ice:panelGroup>
  <div style="height: 1800px;width: 100%;" />
</h:body>
</html>

如果有人可以在兼容性视图的IE7或IE8上测试此代码以确认错误行为,那么就已经有了帮助。

我也想知道这个问题是否与我们在这里使用带有“兼容性视图”的IE8版本而不是独立的IE7(IE8兼容模式是否向服务器发送IE8或IE7标头?)有关。任何人都可以使用独立的IE7进行测试吗?

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

IceFaces 3纠正了这个错误,不再需要解决方法了。