Index: htmlview.c
===================================================================
RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/view/htmlview.c,v
retrieving revision 1.173
diff -u -p -r1.173 htmlview.c
--- htmlview.c	21 Apr 2004 09:17:31 -0000	1.173
+++ htmlview.c	1 Jun 2004 14:51:20 -0000
@@ -1407,10 +1407,15 @@ move_cursor (HtmlView *view, HtmlBox *ne
 			DomElement *element;
 
 			element = DOM_ELEMENT (new_cursor_box->parent->dom_node);
-			if (dom_element_is_focusable (element) &&
-			    element != view->document->focus_element) {
-                		html_document_update_focus_element (view->document, element);
-                		html_view_focus_element (view);
+			if (dom_element_is_focusable (element)) {
+			
+				if (element != view->document->focus_element) {
+                			html_document_update_focus_element (view->document, element);
+                			html_view_focus_element (view);
+				}
+			} else if (view->document->focus_element) {
+				html_document_update_focus_element (view->document, NULL);
+				html_view_focus_element (view);
 			}
 		}
 	}
@@ -3243,7 +3248,9 @@ html_view_focus_element (HtmlView *view)
 		/* No element focused to scroll to top */
 		GtkAdjustment *adj = GTK_LAYOUT (view)->vadjustment;
 
-		set_adjustment_clamped (adj, 0);
+		if (!html_view_get_cursor_visible (view)) {
+			set_adjustment_clamped (adj, 0);
+		}
 		gtk_widget_grab_focus (GTK_WIDGET (view));
 	}
 	gtk_widget_queue_draw (GTK_WIDGET (view));
