| <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> |
| <html> |
| <head> |
| <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="../../../resources/ui-helper.js"></script> |
| </head> |
| <body> |
| <select id="select"> |
| <option>A</option> |
| <option>B</option> |
| <option>C</option> |
| </select> |
| </body> |
| <script> |
| jsTestIsAsync = true; |
| |
| addEventListener("load", async () => { |
| description("This test verifies that focusing a select element, choosing an option, and then switching tabs, does not re-open a menu."); |
| |
| await UIHelper.setHardwareKeyboardAttached(true); |
| |
| // Open and close the <select> menu. |
| await UIHelper.activateElement(select); |
| await UIHelper.waitForContextMenuToShow(); |
| await UIHelper.selectFormAccessoryPickerRow(1); |
| await UIHelper.waitForContextMenuToHide(); |
| |
| // Simulate a tab switch, returning to the current tab. |
| await UIHelper.removeViewFromWindow(); |
| await UIHelper.addViewToWindow(); |
| await UIHelper.becomeFirstResponder(); |
| |
| // Check if the menu was presented after returning to the tab. |
| await UIHelper.ensurePresentationUpdate(); |
| await UIHelper.selectFormAccessoryPickerRow(0); |
| await UIHelper.ensurePresentationUpdate(); |
| didShowContextMenu = select.value === "A"; |
| shouldBeFalse("didShowContextMenu"); |
| |
| finishJSTest(); |
| }); |
| </script> |
| </html> |