forked from rdkcentral/MVT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgfx-test.html
More file actions
128 lines (110 loc) · 3.93 KB
/
gfx-test.html
File metadata and controls
128 lines (110 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hyperlink Buttons</title>
<style>
body {
font-family: sans-serif;
display: flex;
flex-direction: column;
align-items: flex-start; /* Left align to page */
margin-left: 20px;
}
.container {
display: flex;
flex-direction: column;
gap: 20px; /* Vertical alignment */
}
.nav-button {
padding: 10px 15px;
font-size: 16px;
font-weight: bold;
text-decoration: none;
color: white;
background-color: #007BFF;
border: none;
cursor: pointer;
width: 200px; /* Fixed width for alignment */
text-align: left;
box-sizing: border-box;
display: block; /* Ensures the whole area is clickable */
}
.nav-button:focus, .nav-button:hover {
outline: 2px solid #ff5733;
}
.back-link {
margin-top: 20px;
text-decoration: none;
color: #333;
cursor: pointer;
padding: 5px 0;
display: inline-block;
font-weight: bold;
}
.back-link:focus, .back-link:hover {
color: #E74C3C;
text-decoration: underline;
outline: none;
}
</style>
</head>
<body>
<h1>Graphics tests</h1>
<div class="container">
<!-- Button 1 -->
<a href="https://webglsamples.org/fishtank/fishtank.html" target="_blank" class="nav-button" id="button1" tabindex="0">
Test #1 - Fishtank
</a>
<!-- Button 2 -->
<a href="https://webglsamples.org/aquarium/aquarium.html" target="_blank" class="nav-button" id="button2" tabindex="0">
Test #2 - Aquarium
</a>
</div>
<!-- Go Back Link -->
<a href="#" onclick="history.back(); return false;" class="back-link" tabindex="0" id="backLink">
← Go Back to Previous Page
</a>
<script>
// Focus on the first button when the page loads
window.onload = function() {
document.getElementById('button1').focus();
};
const backgroundColor = "#FFFFFF"; //White background
document.body.style.backgroundColor = backgroundColor;
// Keyboard navigation functionality
document.addEventListener('keydown', function(e) {
const focusedElement = document.activeElement;
let nextElement = null;
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
e.preventDefault(); // Prevent scrolling the page
}
if (e.key === 'ArrowDown') {
if (focusedElement.id === 'button1') {
nextElement = document.getElementById('button2');
} else if (focusedElement.id === 'button2') {
nextElement = document.getElementById('backLink');
}
} else if (e.key === 'ArrowUp') {
if (focusedElement.id === 'button2') {
nextElement = document.getElementById('button1');
} else if (focusedElement.id === 'backLink') {
nextElement = document.getElementById('button2');
}
}
if (nextElement) {
nextElement.focus();
}
if (e.key === 'Enter') {
if (focusedElement.id === 'button1') {
window.location.href = 'https://webglsamples.org/fishtank/fishtank.html';
}
else if (focusedElement.id === 'button2') {
window.location.href = 'https://webglsamples.org/aquarium/aquarium.html';
}
}
});
</script>
</body>
</html>