Make links in OpenId dialog focusable

Instead of usng a span with a click handler, use a proper anchor
tag so the browser will permit the user to focus onto the link for
"Google Account" or "Yahoo! Account" and activate the link with
the keyboard.

Change-Id: I49cb42d9eae2bd00a9666fba7526f34be629d676
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-08-04 11:55:35 -07:00
parent 2c9c8a157c
commit 1c114163bb
2 changed files with 16 additions and 6 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.client;
import com.google.gerrit.common.auth.SignInMode;
import com.google.gwtexpui.globalkey.client.GlobalKey;
import com.google.gwtexpui.user.client.AutoCenterDialogBox;
/** Prompts the user to sign in to their account. */
@@ -47,4 +48,10 @@ public abstract class SignInDialog extends AutoCenterDialogBox {
break;
}
}
@Override
public void show() {
super.show();
GlobalKey.dialog(this);
}
}

View File

@@ -34,6 +34,7 @@ import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.FlowPanel;
@@ -239,6 +240,7 @@ public class OpenIdSignInDialog extends SignInDialog implements
final ClickHandler i = new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
event.preventDefault();
if (!discovering) {
providerId.setText(identUrl);
form.submit();
@@ -253,21 +255,22 @@ public class OpenIdSignInDialog extends SignInDialog implements
img.addClickHandler(i);
line.add(img);
final InlineLabel lbl = new InlineLabel();
final Anchor text = new Anchor();
switch (mode) {
case LINK_IDENTIY:
lbl.setText(OpenIdUtil.M.linkWith(who));
text.setText(OpenIdUtil.M.linkWith(who));
break;
case REGISTER:
lbl.setText(OpenIdUtil.M.registerWith(who));
text.setText(OpenIdUtil.M.registerWith(who));
break;
case SIGN_IN:
default:
lbl.setText(OpenIdUtil.M.signInWith(who));
text.setText(OpenIdUtil.M.signInWith(who));
break;
}
lbl.addClickHandler(i);
line.add(lbl);
text.setHref(identUrl);
text.addClickHandler(i);
line.add(text);
formBody.add(line);
}