Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.2, EE-1.8.2.GA_P05
-
Fix Version/s: EE-3.2.0.GA, EE-1.8.2.GA_P06, 3.3
-
Component/s: ICE-Components
-
Labels:None
-
Environment:ICEfaces 1.8.2.GA_P05, ICEfaces 1.8.2
Browsers: Firefox, Chrome, IE
-
Assignee Priority:P3
-
ICEsoft Forum Reference:
Description
1) Deploy attached test application
2) Focus on one of the input fields and press ENTER
The Popup Calendar will appear
See forum reference for more details.
-
Hide
- 18732.war
- 5.38 MB
- Cruz Miraback
-
- META-INF/MANIFEST.MF 0.1 kB
- WEB-INF/classes/.../icefaces/MyBean.class 1 kB
- WEB-INF/classes/com/.../icefaces/MyBean.java 0.9 kB
- WEB-INF/faces-config.xml 0.5 kB
- WEB-INF/lib/FastInfoset.jar 285 kB
- WEB-INF/lib/backport-util-concurrent.jar 319 kB
- WEB-INF/lib/commons-beanutils.jar 226 kB
- WEB-INF/lib/commons-collections.jar 558 kB
- WEB-INF/lib/commons-digester.jar 140 kB
- WEB-INF/lib/commons-discovery.jar 75 kB
- WEB-INF/lib/commons-el.jar 110 kB
- WEB-INF/lib/commons-fileupload.jar 56 kB
- WEB-INF/lib/commons-logging.jar 52 kB
- WEB-INF/lib/icefaces-comps.jar 1.76 MB
- WEB-INF/lib/icefaces.jar 1.24 MB
- WEB-INF/lib/jsf-api-1.2.jar 355 kB
- WEB-INF/lib/jsf-impl-1.2.jar 837 kB
- WEB-INF/lib/jstl.jar 20 kB
- index.jsp 0.0 kB
- main.jspx 1 kB
- WEB-INF/web.xml 2 kB
-
Hide
- 18732-src.zip
- 3 kB
- Cruz Miraback
-
- 18732/build.xml 0.2 kB
- 18732/src/com/.../icefaces/MyBean.java 0.9 kB
- 18732/web/index.jsp 0.0 kB
- 18732/web/main.jspx 1 kB
- 18732/web/WEB-INF/faces-config.xml 0.5 kB
- 18732/web/WEB-INF/web.xml 2 kB
-
- screenshot-01.png
- 299 kB
-
- screenshot-02.png
- 345 kB
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
I also noticed that the image input doesn't support an onfocus event, or for some reason it's not firing that event.
Anyway, I found a quirk in the way browsers fire this artificial click event on the image input. When you press 'enter' on the text field, two different event objects are created: the keyboard event and an artificial click event on the image input. However, I noticed that no onmousedown nor onmouseup events are artificially fired. So, when you actually click on the image, you'll see onmousedown and onmouseup fired first, before the click event, but when you press 'enter' on the text field, you'll only see the artificial click event being fired. So, we could take advantage of this and set a flag either onmousedown or onmouseup to indicate that it is a real click. Then, from the onclick event, we check if this flag is present. If it is, we proceed normally and then remove the flag at the end. If the flag is not present, then we know it's an artificial click event and we ignore it. This is very atomic, so we wouldn't have to worry about the node being replaced.
Doesn't work because when you press enter or space bar while the button has focus, it doesn't generate mousedown or mouseup events either. See video http://screencast.com/t/gD3SfC2W.
If you expand on Art's suggestion, and also add listeners for space/enter keydown events on the image button, that would also set the "real event" flag, that might cover the keyboard use cases as well.
Done. Notes:
- onmousedown: need to check for left click (right click does not popup)
- onkeydown: need to check for enter and space bar (otherwise tab also sets flag)
- onclick: need to reset flag at beginning, not end (because submit could derail all the JS following)
Tested: IE 7, 8, 9. FF 17.
Modified: C:\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDateRenderer.java
Completed: At revision: 32907
Modified: C:\svn\ossrepo\icefaces3\trunk\icefaces\compat\components\src\main\java\com\icesoft\faces\component\selectinputdate\SelectInputDateRenderer.java
Completed: At revision: 32908
Fix verified with ICEfaces EE-1.8.GA-P06 Build1 in IE6/7/8/9, FF18, Chrome24.
This is a known behavioral problem in browsers. Whenever you press ENTER in an input field, the image button just "steals" the event, which is the same as a click on the image button. See screenshot-01 and -02 for example cases.
Verified by creating a simple HTML page. The markup is just this:
<form>
<input type="text"/>
<input type="image" src="cal_button.gif" onclick="alert('image button clicked.');"/>
</form>
See what happens: http://screencast.com/t/GShPjqqIo42y.