Bug 23145

Summary: retain focus after unintentional onblur to allow directional pad navigation
Product: WebKit Reporter: Cary Clark <caryclark>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: tonikitoo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
Bug Depends on:    
Bug Blocks: 23163    
Attachments:
Description Flags
ignore onBlur() clearing focus for directional pad navigation adele: review-

Description Cary Clark 2009-01-06 12:46:51 PST
Android uses a directional pad to move focus spatially, and interprets the directional pad center button as a mouse click on the center of the current focus. 

http://tools.arantius.com/stopwatch
includes this:
<div id='main'>
	<button type='button' onclick='ss()' onfocus='this.blur()'>Start / Stop</button>
	<input type='text' id='disp' />
	<button type='button' onclick='r()' onfocus='this.blur()'>Reset</button>
</div>
So, when using a directional keypad to gain focus on the Start or Reset button, the onfocus attribute removes the focus. This patch ignores the part of blur which clears the document focus if the element does not have an onBlur attribute.

I'm not particularly proud of this fix, but don't have an alternative. What can I do to improve on this patch?
Comment 1 Cary Clark 2009-01-06 12:54:47 PST
Created attachment 26468 [details]
ignore onBlur() clearing focus for directional pad navigation
Comment 2 Adele Peterson 2009-03-23 11:38:21 PDT
Comment on attachment 26468 [details]
ignore onBlur() clearing focus for directional pad navigation

I don't think its wise to ignore blur in this case.  This seems more like a site bug to me.  In Safari, the site won't let you tab to focus those buttons either, so there would be no way to activate the button without a mouse.  I guess the real problem here is that there's no way to tell that this is really an unintentional blur.  If it is unintentional, the site should fix it.
Comment 3 Cary Clark 2010-01-28 08:31:33 PST
Android no longer moves the focus with the direction pad so this is obsolete.