Closed Bug 127892 Opened 23 years ago Closed 21 years ago

dialogKeys keyset has incorrect behaviour

Categories

(SeaMonkey :: UI Design, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.0

People

(Reporter: kinger, Assigned: aaronlev)

References

(Blocks 1 open bug)

Details

(Keywords: access, Whiteboard: need r=,sr=)

Attachments

(1 file, 2 obsolete files)

The scenario is this:
1. Open a dialog that uses this keyset
2. Tab between the buttons [OK, Cancel ...(or equivalents)]
3. Settle on the Cancel button (or equivalent)
4. Hit Return/Enter

Expected behaviour: The Cancel operation is carried out
Actual behaviour: The OK behaviour is carried out.

This can be seen in many places including:
- Renaming a folder in Mail
- Save Page dialog in Composer (closing the window with changes pending)

It is marked as windows but the code is the same all platforms as far as I can see.
The flaw is in the 'oncommand' code of the keys contained the keyset.
<key keycode="VK_ENTER" oncommand="if (!document.getElementById('ok').disabled)
doOKButton();"/>
<key keycode="VK_RETURN" oncommand="if (!document.getElementById('ok').disabled)
doOKButton();"/>
This code is not sufficient in that all it does is checks if the OK button is
disabled or not, and carries out the handler if it is not. In most cases, the OK
button will always be enabled. Also, it does not pay attention to the focus
context, i.e what button the user wishes to activate when ENTER is pressed, so
any behaviour other than OK will not be carried out.

Possible solutions:
1. Remove use of dialogKeys in all dialogs. I'm not sure how the window handlers
for ondialogaccept/ondialogcancel, etc. behave, but using them may bypass the
need for this keyset. Dialogs that use them behave correctly.
2. Clean up the code. Add a function to dialogOverlay.js that "does the right
thing". This is then called from the keys (patch to follow).
This patch does the following:
- If a button has the focus, execute the function hooked up to it
- If no button has focus, do the default button (if not disabled)
- If no button has focus, and the default button is disabled, do nothing
Keywords: access, patch
do we need to fix other platforms?
this bug sounds familiar; are there duplicates out there?
Brian, any chance you can fix 84308 as well?
(Should be able to arrow between buttons in dialog boxes)
Attachment #71520 - Flags: needs-work+
Comment on attachment 71520 [details] [diff] [review]
proposed patch for ENTER behaviour with dialogKeys keyset

this patch can't be used because only windows like os's get this behavior. (i
think we have to read bugs from mpt to see which os's are windows like wrt
this)
Kathy: I could not find duplicates. There may be bugs out there for this
behaviour in individual dialogs, but this I believe is the root fo the issue.

Aaron: I'll have a look at that bug when I get a chance.

timeless: If you have any information (or know where I can get it) about the
behaviour on other platforms, I would be glad to hear it.
mpt suggested bug 63728
Blocks: focusnav
There was some discussion about platform behaviour over in 63728, though I don't
think there was complete resolution even though it is marked VERIFIED. There is
still clearly incorrect behaviour on windows at least (see first comment in this
bug).

Adding possibly interested folks.
No longer blocks: focusnav
Depends on: 63728
Blocks: focusnav

*** This bug has been marked as a duplicate of 63728 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
Reopening due to closure of #63728. This is still an issue. We can address the
Mac issues here too or open a bug on it.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Proposing this be fixed for mozilla 1.0. This is basic UI functionality.
Keywords: mozilla1.0
*** Bug 108924 has been marked as a duplicate of this bug. ***
You should also need to modify .xul file of unix/mac/os2?
Yes, I will submit a new patch but most likely will leave the current behaviour
for the Mac, which should apparently always do the ok behaviour on ENTER.
No longer depends on: 63728
Attachment #71520 - Attachment is obsolete: true
Assed the new call to keys in unix and os/2 overlays. Mac issue is addressed by
ignoring it. Leave functionality as is there, as I am told ENTER should always
do ok (or equivalent) routine there.
Keywords: review
Hardware: PC → All
blaker, hewitt, brade - could you please have a look at this patch for review.
Whiteboard: need r=,sr=
* can we add a comment above doButtonChoice() function that explains that it
isn't desirable to have this called on Macintosh (in case someone reading the
code doesn't realize that it's not used on all platforms at this time)?

* I wonder if we should check for buttons 2 and 3 before cancel (in case somehow
the "default" flag got set on more than 1 button?).  The cancel button *might*
be worse; it's really hard to say.

* I wonder if we should beep in this block (or is that a Mac-thing to do?):
+     // If no button has focus, and the default button is disabled, do nothing
+    else  {
+        return;
+    }
see bug 132720 for comparison.
Bryner, nominating for 1.0, as this potentially has a more widespread effect
than bug #132720 which is Mac only. Feel free to change or add comments as you wish.
OS: Windows 2000 → All
Target Milestone: --- → mozilla1.0
Attachment #74558 - Attachment is obsolete: true
Have patch, taking
Assignee: blaker → aaronl
Status: REOPENED → NEW
Attachment #127271 - Flags: superreview?(jaggernaut)
Attachment #127271 - Flags: review?(sgehani)
Attachment #127271 - Flags: review?(sgehani) → review?(neil.parkwaycc.co.uk)
Comment on attachment 127271 [details] [diff] [review]
In dialogKeys, don't handle Enter/Return if already on a button -- let it fall through and the normal binding for button will handle it

Bah, why do we still have so many clients of this stuff?
Actually, I do know one reason - a <dialog> is limited in the placement of the
buttons so it's not even any good for switch profile.
I've come up with two possible alternatives:
1. A <dialogbuttons> tag which you can include anywhere you like in your
<dialog>, defaulting to the anonymous one in the <dialog>
2. Move the keyset, button labels and oncommand into dialogOverlay.xul and add
dlgtype to the buttons in platformDialogOverlay.xul so that you can overlay
platformDialogOverlay.xul if you want to be able to put buttons in a different
place in the dialog.
Attachment #127271 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #127271 - Flags: superreview?(jaggernaut) → superreview+
checked into 1.5b trunk
Status: NEW → RESOLVED
Closed: 23 years ago21 years ago
Resolution: --- → FIXED
Product: Core → Mozilla Application Suite
Component: XP Apps: GUI Features → UI Design
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: