Closed Bug 122311 Opened 24 years ago Closed 14 years ago

After onfocus event is finished, textarea has no focus.

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: jay.yan, Unassigned)

References

()

Details

Attachments

(1 file)

On Windows version 1 open a mozilla browser 2 load http://mozilla.org/quality/browser/standards/html/textarea_onfocus.html 3 click the url address and make sure textarea has no focus 4 click textarea, an alert dialog appears 5 click ok, caret is on textarea 6 press keyboard to input some characters, nothing happens to textarea Expected results: The input characters should appear in textarea, because TextArea is assumed to have got focus.
Blocks: 50092
this bug should be fixed prior to bug 50092, and 50092 is *nix specificed, but this bug happens on all the platforms The reason of this bug is that becasue after aContent->HandleDomEvent is finisned, the nsEventStateManager->mCurrentFocus becames null, following code will not be executed: nsIFrame * currentFocusFrame = nsnull; if (mCurrentFocus) presShell->GetPrimaryFrameFor(mCurrentFocus, &currentFocusFrame); if (!currentFocusFrame) currentFocusFrame = mCurrentTarget; // Find the window that this frame is in and // make sure it has focus if (currentFocusFrame) { nsIFrame * parentFrame; currentFocusFrame->GetParentWithView(aPresContext, &parentFrame); if (nsnull != parentFrame) { nsIView * pView; parentFrame->GetView(aPresContext, &pView); if (nsnull != pView) { nsIWidget *window = nsnull; nsIView *ancestor = pView; while (nsnull != ancestor) { ancestor->GetWidget(window); // addrefs if (nsnull != window) { window->SetFocus(); NS_RELEASE(window); // releases. Duh. break; } ancestor->GetParent(ancestor); } } } } the patch moves above code ahead of aContent->HandleDOMEvent, it works. I will attach patch for bug 50092 later.
Confirming issue.
Assignee: attinasi → rods
Status: UNCONFIRMED → NEW
Component: Layout → HTML Form Controls
Ever confirmed: true
QA Contact: petersen → madhur
On the OS X build (2002-01-31-08), I not only lose focus in either textarea/input field but url field nolonger gets focus.
->>
Assignee: rods → kin
Hm... I'd say a safer fix might be to obtain currentFocusFrame prior to dispatching the DOM event, but leave the nsIWidget SetFocus() where it is now. That would have less of a chance of regressing something, I think.
Target Milestone: --- → mozilla1.0.1
QA Contact: madhur → tpreston
Priority: -- → P3
Target Milestone: mozilla1.0.1 → Future
A test suite has been created to track bug 58441, bug 134293, bug 105129, bug 131843, bug 50221, bug 134321, bug 122311, and bug 112294: http://bugzilla.mozilla.org/attachment.cgi?id=100778&action=view People who have reported problems in the bugs mentioned please perform all the test in this suite. All bugs will be resolved as duplicate of the appropriate bug unless someone can reproduce a problem with onblur/onfocus style change (no alert involved)
Depends on: 58441
Assignee: kinmoz → events
Component: Layout: Form Controls → Event Handling
QA Contact: tpreston → ian
No longer blocks: badtests
Assignee: events → nobody
QA Contact: ian → events
wfm with Mozilla/5.0 (Windows NT 6.1; rv:13.0a1) Gecko/20120214 Firefox/13.0a1 SeaMonkey/2.10a1 The textarea has focus after dismissing the alert and i can type.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: