Opened 10 years ago
Closed 10 years ago
#11836 closed defect (fixed)
[patch][cla] Form widgets interfere with dijit.Menu
Reported by: | avoidscorn | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | Dijit | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Tested on Firefox 3.6.10/Linux and Chromium 6.0.472.62/Linux.
If you bind a dijit.Menu
to a form widget and then right-click on the form widget, the form widget will steal focus from the menu popup and close it as soon as you mouse-up.
The culprit is dijit._FormWidget._onMouseDown
, which attempts to restore focus to the form widget even if the user mouse-ups somewhere else. This works fine unless the focus was on a popup that just opened.
The attach test case patch adds a form widget to test_Menu.js
.
I'm attaching two possible fixes:
ignoreRightClick.patch
:dijit._FormWidget
ignores right clicks for focus-grabbing purposes. This will not fix the issue forleftClickToOpen=true
menus. However those menus don't work for form widgets anyway, because form widgets almost always capture left clicks, so it's a moot point.detectPopup.patch
:dijit._FormWidget
checks to see if a popup opened before it tries to grab focus. In theory, this will work forleftClickToOpen=true
menus.
Another alternative is to make dijit.Menu
try and stop mousedown/mouseup events from being detected by the form widget, but that seems risky.
Attachments (6)
Change History (13)
Changed 10 years ago by
Attachment: | testCase.patch added |
---|
Changed 10 years ago by
Attachment: | ignoreRightClick.patch added |
---|
_FormWidget.js patch to ignore right clicks
comment:2 Changed 10 years ago by
ignoreRightClick.patch seems safe, except dojo.mouseButtons.isLeft() is the portable way to test mouse buttons. (You didn't say you tested your patch on IE, I bet it doesn't work there.) You just need to add a section to Menu_mouse.html (the robot test) to automate the test you added to test_Menu.html.
I looked up the reason for the whole _onMouseDown() handler. It's from #5434 and also #6888, although it no longer seems to be necessary for getting buttons on Chrome to focus when mouseup happens outside the button. But it is still necessary for ValidationTextBox widgets to get focus when the user clicks the right section, where the validation icon is.
comment:3 Changed 10 years ago by
Owner: | set to Douglas Hays |
---|
Changed 10 years ago by
Attachment: | ignoreRightClick2.patch added |
---|
Uses dojo.mouseButtons.isLeft to detect left-clicks
Changed 10 years ago by
Attachment: | testCase2.patch added |
---|
Display "dijit.form._FormWidget" instead of "dijit._FormWidget"
comment:5 Changed 10 years ago by
Milestone: | tbd → 1.6 |
---|
avoidscorn, do you have a signed CLA on file with Dojo?
comment:7 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
test_Menu.html patch