Closed Bug 524310 Opened 15 years ago Closed 14 years ago

Can't select out of view option in scrollable menulist

Categories

(Testing Graveyard :: Mozmill, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: merike, Assigned: ahal)

References

Details

(Whiteboard: [qae-p1][mozmill-1.4.2+])

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; et; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729) Build Identifier: controller.select is unable to select an item in menulist if it's long and scrolling is needed to reach the item. Menulist is left open and option is not selected. At the end of test run select is reported as a pass. Reproducible: Always Steps to Reproduce: 1. var RELATIVE_ROOT = './shared-modules'; var MODULE_REQUIRES = ['PrefsAPI']; var setupModule = function(module) { controller = mozmill.getBrowserController(); } var testPreferencesPanes = function() { PrefsAPI.preferencesDialog.open(prefDialogCallback); } var prefDialogCallback = function(controller) { PrefsAPI.preferencesDialog.setPane(controller, "paneContent"); controller.sleep(1000); //controller.select(new elementslib.ID(controller.window.document, "defaultFont"), undefined, "Georgia"); // works controller.select(new elementslib.ID(controller.window.document, "defaultFont"), undefined, "Verdana"); // doesn't work controller.sleep(3000); PrefsAPI.preferencesDialog.close(controller); }
Neil, we synthesize a click event to select an option in the menulist but if the item is not visible we would have to scroll down. Is there a function we can use to scroll down to the wanted element? I tried a couple of ways but I wasn't able to get access to the scrollbar. Even assigning a value to curpos of the menulist doesn't update the scrollbar.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86 → All
Four options: - synthesize an End keypress to scroll to the end, or the Cursor Down key until the items are in view. - synthesize mouse events on the area where you think the scrollbar will be (harder to be accurate cross-platform) - get the internal anonymous box inside the menulist popup and set the scrollTop property (not as forward compatible) - wait until a good scroll api is available for menulists (no good for you today)
Blocks: 529421
We should try to get this fixed. Adding as P1 for next quarter.
Whiteboard: [qae-p1]
this is one of the things that got harder and possibly impossible once we moved to positional event synthesis instead of even synthesis on DOM nodes. the tests I had I just simulated scroll to make the node i cared about visible, I think that is the best we can do for now.
Whiteboard: [qae-p1] → [qae-p1][mozmill-1.4.2+]
Assignee: nobody → ahalberstadt
It seems like this isn't an issue with HTML (see attached test). Haven't gotten around to testing XUL outside of the preference dialog yet, I'll look into that tomorrow.
Pull request submitted, patch available here: http://github.com/ahal/mozmill/commit/d0195479678238d2d2da2fffff49d5b33e5a8255 controller.select() will now scroll down until the menuitem element is visible before trying to click it.
Status: NEW → ASSIGNED
Whimboo, please push this, I've already reviewed it.
Merged with Mikeal's repository. I will try to get it verified in the next days. At least the testcase from Merike works perfect now. Merike, do you agree?
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
It works a lot better now. I ran a similar testcase (adapted to changes in shared modules) three times in a row. Started out with font set to serif (first entry in select). First time I saw Arial and Georgia both selected properly. Second time when Georgia was default it scrolled all the way down even though Arial is visible right after opening select. Arial was finally selected but select was not closed. Georgia wasn't selected at all. Third time when Arial was default I saw both selected again although it scrolled all the way through before selecting Arial. I then added a sleep between two select calls. This made it a lot better. Both Arial and Georgia were selected on each run. Arial scrolled all the way down still but I guess that's not an issue as it ended up selecting correct value. So it definitely works the first time and for more complicated tests a sleep is enough to have it working too.
Status: RESOLVED → VERIFIED
As is, if an item is currently selected and you try to select it again, it will scroll through the entire list. The trade-off is either to do it this way, or use tons of if-else statements. There are two main reasons behind this: 1) If the menulist currently has nothing selected (i.e selected index of -1) it won't break as it will start searching at index i + 1. 2) If we are trying to select the last item in the list we have to be careful not to press the down key one too many times or we'll end up back at the top. However, if the currently selected item is the last item in the list we NEED to press the down arrow key at least once (as by default the menulist does not open with currently selected item visible) which brings us back to the top. Again this issue is solved by starting the search one item after the currently selected one.
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: