Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fixed issues with tabbing on direct input

Taylor Gunnoe92ee275282f5
diff --git a/src/css/new-ui.css b/src/css/new-ui.css
index 1122bed68..3ec5017de 100644
--- a/src/css/new-ui.css
+++ b/src/css/new-ui.css
@@ -64,11 +64,13 @@
}
/* Temporary sizing of inputs until something more dynamic can be made */
-#timeline header input:nth-child(1){width:2em;padding:3px;}
-#timeline header input:nth-child(2){width:1.8em;padding:3px;}
-#timeline header input:nth-child(3){width:1.1em;padding:3px;}
-
+#timeline header input:nth-child(2){width:2em;padding:3px;}
+#timeline header input:nth-child(3){width:1.8em;padding:3px;}
+#timeline header input:nth-child(4){width:1.1em;padding:3px;}
+#timeline header .focus-guard{
+/* display:none;
+*/}
#timeline header input:hover{
border-color:#fff;
}
@@ -100,7 +102,6 @@ display:inline-block;}
fill:#cccccc;
fill-opacity:1;
stroke:none;
-
}
#timeline header, #timeline footer{
display:inline-block;
diff --git a/src/index.html b/src/index.html
index 3fa9b17ed..95a8cfee6 100644
--- a/src/index.html
+++ b/src/index.html
@@ -217,9 +217,11 @@
<section id="timeline">
<header>
- <input type="text" value="2014" maxlength="4" class="button-input-group" id="year-input-group" tabindex="1" />
- <input type="text" value="Mar" maxlength="3" class="button-input-group" id="month-input-group" tabindex="2" />
- <input type="text" value="03" maxlength="2" class="button-input-group" id="day-input-group" tabindex="3" />
+ <div id="focus-guard-1" class="focus-guard" tabindex="1"></div>
+ <input type="text" value="2014" maxlength="4" class="button-input-group" id="year-input-group" tabindex="2" />
+ <input type="text" value="Mar" maxlength="3" class="button-input-group" id="month-input-group" tabindex="3" />
+ <input type="text" value="03" maxlength="2" class="button-input-group" id="day-input-group" tabindex="4" />
+ <div id="focus-guard-2" class="focus-guard" tabindex="5"></div>
<div class="button-action-group" id="left-arrow-group">
<svg>
<path
diff --git a/src/js/date/wv.date.timeline.js b/src/js/date/wv.date.timeline.js
index b500aeb18..e86120679 100644
--- a/src/js/date/wv.date.timeline.js
+++ b/src/js/date/wv.date.timeline.js
@@ -266,41 +266,43 @@ wv.date.timeline = wv.date.timeline || function(models, config) {
/****************************** TIMELINE LINES ************************************/
- d3.select("#timeline footer").on("mouseenter", function() {
+ d3.select("#timeline footer")
+ .on("mouseenter", function() {
$("#timeline-text").show();
hoverLineGroup.style("opacity", 1);
- }).on("mousemove", bindTimelineMouseMove).on("mouseleave", function() {
+ })
+ .on("mousemove", bindTimelineMouseMove)
+ .on("mouseleave", function() {
hoverLineGroup.style("opacity", 1e-6);
$("#timeline-text").hide();
-
- }).on("click", function(){
- var mouse_x = d3.mouse(this)[0];
- model.select(x.invert(mouse_x));
-
- })/*.on("mousedown",function(){
+ })
+ .on("click", bindUpdateOnFooter)/*.on("mousedown",function(){
mouse_x_start = d3.mouse(this)[0];
var mouse_x_jump = mouse_x_start + timelineJump;
console.log("$$$$$$$$$$$$ ");
- })*/;
+ })*/;
- $("svg#now-line").mousedown(function(e){
+ $("svg#now-line")
+ .mousedown(function(e){
e.preventDefault();
- d3.select("#timeline footer").on("mousemove", function(){
- var mouse_x = d3.mouse(this)[0];
- model.select(x.invert(mouse_x));
- });
- }).mouseup(function(){
- d3.select("#timeline footer").on("mousemove", null);
- d3.select("#timeline footer").on("mousemove", bindTimelineMouseMove);
- });
+ d3.select("#timeline footer")
+ .on("mousemove", bindUpdateOnFooter);
+ })
+ .mouseup(function(){
+ d3.select("#timeline footer")
+ .on("mousemove", null);
+ d3.select("#timeline footer")
+ .on("mousemove", bindTimelineMouseMove);
+ });
/**************************END TIMELINE LINES****************************/
//bind click action to interval radio buttons
var buttons = $('.button-input-group');
- buttons.click(function(e){
+ buttons.on('focus',function(e){
+ // e.stopPropagation();
+ // e.preventDefault();
buttons.removeClass('button-input-group-selected');
- $(this).addClass("button-input-group-selected");
-
+ $(this).addClass('button-input-group-selected');
jumpInterval = $(this).attr('id');
switch(jumpInterval){
case 'year-input-group':
@@ -316,10 +318,10 @@ wv.date.timeline = wv.date.timeline || function(models, config) {
alert("cannot find selected interval!");
break;
}
-
- $(this).select();
updateBarSpeed();
+ $(this).select();
});
+
model.events.on("select", function(){
updateTime();
});
@@ -329,6 +331,14 @@ wv.date.timeline = wv.date.timeline || function(models, config) {
setData();
}
});
+
+ $("#focus-guard-1").on('focus',function(){
+ $("#day-input-group").focus().select();
+ });
+ $("#focus-guard-2").on('focus',function(){
+ $("#year-input-group").focus().select();
+ });
+
updateTime();
$('#day-input-group').addClass('button-input-group-selected');
bindBtnsToDay();
@@ -368,23 +378,9 @@ wv.date.timeline = wv.date.timeline || function(models, config) {
}
}
});
- $("#timeline header").on('keydown', '.button-input-group', function(e) {
- var keyCode = e.keyCode || e.which;
- if (keyCode == 9) {
- var tabIndex = $(this).attr('tabindex');
- var inputBtns = $('.button-input-group');
- e.preventDefault();
- var ntabindex = parseInt(document.activeElement.tabIndex);
- ntabindex++;
- inputBtns.removeClass('button-input-group-selected');
- $('input[tabindex='+ntabindex+']').focus().addClass('button-input-group-selected').select();
-
- }
- });
-
}; // /init
- var bindTimelineMouseMove = function() { //FIXME: Replace with function
+ var bindTimelineMouseMove = function() {
var mouse_x = d3.mouse(this)[0];
var graph_x = x.invert(mouse_x);
var format = d3.time.format('%e %b');