Reviewers: jgw, Description: Our version implementations of FocusImpl have quite a few problems. First, the hidden text input that we use capture native events and scrolls the screen at unexpected times. Second, our implementation of accessKey is totally broken for FF.
Fix: ==== All modern browsers now support tabIndex/focus on all elements, which means that any div can be focusable. So, for the most part, we can use the simple FocusImpl implementation for all browsers. We still have some quirks to work around in IE/Safari, so we can't completely get rid of the other impls. However, only IE supports the accessKey attribute on all elements (FF and webkit only support it on input elements and a couple others). As a result, we still need to use the hidden text area to enable accessKeys are arbitrary focusable widgets. However, we now use it only for this purpose, and the text input doesn't keep focus, so we no longer eat events or jump around when the user clicks or tabs into an element. Testing: ======== We can't write unit tests for focus because IE actually has to be at the top of the window stack to correctly receive focus, which causes tests to fail. As far as I know, there is no way to programmatically test access keys. I manually verified that focus and access keys works correctly on all modern browsers. I also verified that this patch fixes about a bunch of focus related issues. Unfortunately, accessKeys aren't working in Opera. As far as I can tell, accessKeys only work if the element was on the original HTML page. If an element is created using DOM manipulation or innerHTML, its accessKey is ignored. Please review this at http://gwt-code-reviews.appspot.com/132801 Affected files: user/src/com/google/gwt/dom/client/AnchorElement.java user/src/com/google/gwt/dom/client/AreaElement.java user/src/com/google/gwt/dom/client/ButtonElement.java user/src/com/google/gwt/dom/client/Element.java user/src/com/google/gwt/dom/client/InputElement.java user/src/com/google/gwt/dom/client/ObjectElement.java user/src/com/google/gwt/dom/client/SelectElement.java user/src/com/google/gwt/dom/client/TextAreaElement.java user/src/com/google/gwt/user/Focus.gwt.xml user/src/com/google/gwt/user/client/ui/impl/FocusImpl.java user/src/com/google/gwt/user/client/ui/impl/FocusImplOld.java user/src/com/google/gwt/user/client/ui/impl/FocusImplSafari.java user/src/com/google/gwt/user/client/ui/impl/FocusImplStandard.java
-- http://groups.google.com/group/Google-Web-Toolkit-Contributors
