| <!DOCTYPE html> |
| <html> |
| <head> |
| </head> |
| <body> |
| <p>This test ensures that the focus ring is shown on the checkbox after tabbing out and inside the window.</p> |
| <input type="checkbox" id="checkbox"> |
| <input id="input"> |
| <pre id="console"> |
| </pre> |
| |
| <script> |
| var checkbox = document.getElementById('checkbox'); |
| var input = document.getElementById('input'); |
| window.onfocus = function() { |
| log('window was focused'); |
| }; |
| window.onblur = function() { |
| log('window was blurred'); |
| }; |
| checkbox.onfocus = function() { |
| log('checkbox was focused'); |
| }; |
| checkbox.onblur = function() { |
| log('checkbox was blurred'); |
| }; |
| input.onfocus = function() { |
| log('input was focused'); |
| }; |
| input.onblur = function() { |
| log('input was blurred'); |
| }; |
| window.onload = function() { |
| if (window.eventSender) { |
| eventSender.mouseMoveTo(checkbox.offsetLeft + 2, checkbox.offsetTop + 2); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| // Shift focus to other input element. |
| eventSender.keyDown('\t'); |
| internals.setFocused(false); |
| // Set focus to the checkbox. |
| internals.setInitialFocus(false); |
| // Upon focus, the default focus ring should be displayed because the |
| // focus was triggered by the keyboard (tab). |
| internals.setFocused(true); |
| } |
| }; |
| |
| function log(message) { |
| var console = document.getElementById("console"); |
| console.textContent += message + '\n'; |
| } |
| </script> |
| </body> |
| </html> |