forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manual test to verify if bounding box is updated in AAPI upon focus
- Loading branch information
1 parent
ddcdc04
commit bd0f5bb
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
2dcontext/drawing-paths-to-the-canvas/canvas_focus_drawFocusIfNeeded_AAPI_001-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>drawFocusIfNeeded() - AAPI test</title> | ||
<link rel="author" title="Mark Sadecki" href="[email protected]"> | ||
<link rel="help" href="http://www.w3.org/TR/2dcontext/#dom-context-2d-drawFocusIfNeeded"> | ||
|
||
</head> | ||
<body> | ||
<h1>Description</h1> | ||
<p>This manual test can be used to verify that drawFocusIfNeeded actually updates the accessible location information (i.e. UIAutomation's CurrentBoundingRectangle) in the Accessibility API. To perform this test, you will need an <a href="http://www.w3.org/WAI/PF/wiki/ARIA_Test_Plan#Test_tools">accessibility API inspector</a>. To perform this test, use the <code>tab</code> key to move from the first focusable element to through to the fourth. This test passes if the first parameter of the bounding rectangle increases by 100 when focus is moved from the gray square to the orange square.</p> | ||
<p><a href="http://www.w3.org">First focusable element</a></p> | ||
<canvas height=100 width=200 id=canvas> | ||
<a href='http://www.w3.org' id='button1'>Second focusable element</a> | ||
<a href='http://www.w3.org' id='button2'>Third focusable element</a> | ||
</canvas> | ||
<p><a href="http://www.w3.org">Fourth focusable element</a></p> | ||
|
||
<script> | ||
var button1 = document.getElementById('button1'); | ||
var button2 = document.getElementById('button2'); | ||
var canvas = document.getElementById('canvas'); | ||
var buttons = canvas.getElementsByTagName('a'); | ||
|
||
for (var i = 0; i < buttons.length; i++) { | ||
buttons[i].addEventListener('focus', drawCanvas, false); | ||
buttons[i].addEventListener('blur', drawCanvas, false); | ||
} | ||
|
||
function drawRect(context, color, element) { | ||
context.beginPath(); | ||
context.rect(10, 10, 80, 80); | ||
context.fillStyle = color; | ||
context.fill(); | ||
context.drawFocusIfNeeded(element); | ||
context.save(); | ||
} | ||
|
||
function drawCanvas() { | ||
var canvas = document.getElementById('canvas'); | ||
var context = canvas.getContext('2d'); | ||
context.clearRect (0, 0, 200, 100); | ||
|
||
drawRect(context, "gray", button1); | ||
context.translate(100,0); | ||
drawRect(context, "orange", button2); | ||
context.translate(-100,0); | ||
} | ||
drawCanvas(); | ||
</script> | ||
</body> | ||
</html> |