Closed Bug 197568 Opened 22 years ago Closed 22 years ago

Dialog box with multiline textbox closes when user hits Enter in textbox

Categories

(Core :: XUL, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: WeirdAl, Assigned: hewitt)

References

()

Details

Attachments

(1 file)

Given an XUL dialog box like this:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        buttons="accept,cancel">
  <textbox multiline="true" rows="10" cols="40"/>
</dialog>

the user cannot use the Enter or Return keys in the textbox.  This is because
the event handlers at the end of the binding file call _hitEnter(), and the
_hitEnter() function doesn't bother to check for an <html:textarea/> element.

The fix should be easy:
(1) Pass the event object from the handlers to the _hitEnter() method.
(2) Add an evt argument to the _hitEnter() function, to receive the event object.
(3) Check for ((evt.target.tagName != "textarea")&&(evt.target.namespaceURI !=
"http://www.w3.org/1999/xhtml")) before firing this.acceptDialog().
"patches accepted"  ;)
Assignee: hyatt → hewitt
Blocks: 113146
Attached patch patchSplinter Review
Attachment #117354 - Flags: superreview?(bryner)
Attachment #117354 - Flags: review+
Comment on attachment 117354 [details] [diff] [review]
patch

It would be nice if we could check whether the event was consumed by editor,
instead of checking the target like this.  Unfortunately, there's no way to
guarantee that this handler will be fired after editor's.  sr=me.
Attachment #117354 - Flags: superreview?(bryner) → superreview+
I've been offline for a few days; can we check this in?
checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: