Opened 12 years ago

Closed 11 years ago

Last modified 8 years ago

#6519 closed defect (fixed)

Textarea: Focus problem in FF2

Reported by: guest Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.0
Keywords: Cc: ben@…
Blocked By: Blocking:

Description

Hi, first of all thanks for implementing the onfocus and onblur for textareas!

Unfortunately, with Firefox 2, the focus event does not work quite ok:

  • When navigating with Tabs, only on the second tab press the onfocus event is executed
  • When using the mouse, the onfocus event only works when the box of the textarea is clicked, not the interior.

This might be related to the issue where navigating away from a textarea in FF needs tab to be pressed twice.

if you have any questions: my email is ben-at-benzahler.ch

thanks

Attachments (1)

6519.2.patch (2.2 KB) - added by Douglas Hays 11 years ago.
Munged focus manager to connect focus/blur to the document instead of body for non-IE. Changed _onFocusNode to ignore body focus events immediately after a blur instead of all the time

Download all attachments as: .zip

Change History (13)

comment:1 Changed 12 years ago by bill

Component: GeneralDijit
Milestone: 1.3
Owner: changed from anonymous to Douglas Hays

I feel like we fixed this before but I can't find the ticket; perhaps I'm getting confused with Editor. Or maybe we decided is wasn't feasible to fix this on FF2? I can't remember. (Does problem still happen on FF3?)

comment:2 Changed 11 years ago by Douglas Hays

Milestone: 1.31.2
Status: newassigned

comment:3 Changed 11 years ago by Douglas Hays

Summary: Textarea: Focus in FF[patch][ccla]Textarea: Focus in FF

comment:4 Changed 11 years ago by bill

The registerWin() call makes sense, but the changes to focus.js don't seem right... dijit._onFocusNode(node) needs to be called with the node that got focused; with your patch isn't it always called with <body> ?

Also, the reason that _onFocusNode(node) returns instantly when node==<body> is (for example) when a user presses the arrow keys on a Spinner... IIRC on some browser it would defocus the input and focus the body, but we want to continue to say that the Spinner is focused.

In general a focus event on <body> is more like a blur than a focus, although I understand that TextArea with the iframe is a special case.

comment:5 Changed 11 years ago by Douglas Hays

(In [14687]) References #6519. Textarea on FF2 uses an iframe and should have registered it with the focus manager.

Changed 11 years ago by Douglas Hays

Attachment: 6519.2.patch added

Munged focus manager to connect focus/blur to the document instead of body for non-IE. Changed _onFocusNode to ignore body focus events immediately after a blur instead of all the time

comment:6 Changed 11 years ago by Douglas Hays

Milestone: 1.2tbd
Owner: changed from Douglas Hays to bill
Status: assignednew
Summary: [patch][ccla]Textarea: Focus in FFTextarea: Focus problem in FF2

Reassigning as a focus manager problem. The current focus manager listens for focus and blur events on the body tag of an iframe, but in FF2, you apparently have to listen on the document instead, at least for iframes.

comment:7 Changed 11 years ago by bill

Milestone: tbd1.2

I think [14687] fixed the mouse problem. In http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_Textarea.html the mouse is working correctly for me. Try clicking in/out of the Textarea with the red border and you get "user focus handler" / "user blur handler" messages.

As for keyboard, I am seeing an issue that tabbing into a Textarea doesn't cause the focus handler to be called, and as Doug said monitoring focus/blur on the document rather than <body> seems to fix it, so I'll work on that.

Note that on IE with widgets like Spinner, clicking the up/down arrows sets focus to <body>; we have special code to ignore those type events, since clicking the up/down arrows shouldn't cause a notification that focus has left the spinner. Need to be careful not to break that.

comment:8 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

(In [15197]) Fixes #6519: Textarea: Focus problem in FF2 Monitor focus events on document rather than <body>, seems to work better for iframe on FF2.

Tested change for Editor, Textarea, and Spinner on all browsers. Seems to be working.

!strict

comment:9 Changed 11 years ago by bill

Ref'd in [15692]: Fix for DateTextBox? inside of iframe. Fixes #7979.

Actually this is cleanup from [15197] (refs #6519); forgot to change a reference from <body> to the document." /workspace/1.2/dijit/_base/focus.js /workspace/trunk/dijit/_base/focus.js

comment:10 Changed 11 years ago by bill

Looks like this change broke tabbing into an editor on FF3/mac (and maybe other places too), in that the focus manager thinks nothing has focus. It works correctly on IE7.

comment:11 Changed 11 years ago by bill

(In [16554]) [15197] and [15692] had problems. They didn't differentiate between clicks/focus on an Editor's iframe's document, and on the "main" document where dojo is loaded, if the main document itself was an iframe.

Adding explicit code to register that click/focus on the the Editor's iframe's document are to be reported as click/focus on the Editor's <iframe> node.

BTW this fix also masks differences between browsers as to where the focus event is reported:

  • FF: the event was reported on the document, but mysteriously the Editor's iframe's document and the main window's document are the same,or at least they appear to be the same in a console.log().
  • IE: the <iframe> node
  • Safari: the iframe's <body> node

Refs #6519, #7979, fixes #8577. !strict

comment:12 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.