Permalink
Browse files

Attempted fix for ios sizing and focus issues

  • Loading branch information...
rtennys committed Jun 4, 2017
1 parent 477d900 commit 5048afbc5778c5d308cc14184115f22625d7ff4f
Showing with 18 additions and 7 deletions.
  1. +2 −0 Momo.UI/Content/Site.css
  2. +12 −5 Momo.UI/Scripts/Site.AddListItem.Index.js
  3. +4 −2 Momo.UI/Views/AddListItem/Index.cshtml
@@ -37,6 +37,8 @@ table { border-collapse: collapse; border-spacing: 0; }
/* elements */
* { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
*:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
body { background: #fff none repeat scroll 0 0; line-height: 1.3; font-size: .85em; font-family: helvetica, arial, sans-serif; }
a, a:visited { text-decoration: none; }
@@ -50,10 +50,11 @@
function onAddItem(e) {
e.preventDefault();
_searchInput.focus().select();
var form = $(this);
app.post(form.attr('action'), form.serializeArray(), function () {
form.find('span[name="name"]').removeClass('list-item-status-none list-item-status-new').addClass('list-item-status-exists');
setTimeout(function () { _searchInput.focus().select(); }, 100);
setTimeout(function () { _searchInput.focus().select(); });
});
}
@@ -64,13 +65,19 @@
}
function onKeydown(e) {
if (e.which !== 38 && e.which !== 40) return true;
var upArrow = 38;
var downArrow = 40;
if (e.which !== upArrow && e.which !== downArrow) return true;
var allForms = $('form');
var index = allForms.index($(e.currentTarget).closest('form')) + (e.which === 38 ? -1 : 1);
var index = allForms.index($(e.currentTarget).closest('form')) + (e.which === upArrow ? -1 : 1);
if (allForms.length > index)
setTimeout(function () { allForms.eq(index).find('[name="quantity"]').focus().select(); });
if (allForms.length > index) {
var nextQtyInput = allForms.eq(index).find('[name="quantity"]');
nextQtyInput.focus().select();
setTimeout(function () { nextQtyInput.focus().select(); });
}
e.preventDefault();
return false;
@@ -14,7 +14,9 @@
@Html.Hidden("username")
@Html.Hidden("shoppinglist")
<ol>
<li>@Html.TextBox("name", null, new {autocomplete = "off"})</li>
<li class="row">
@Html.TextBox("name", null, new { autocomplete = "off", style = "width: 100%;" })
</li>
</ol>
@Html.ValidationSummary()
}
@@ -51,7 +53,7 @@
<span name="name"></span>
</div>
<div class="span2">
<input type="number" name="aisle" style="width: 75%; max-width: 25px;" />
<input type="number" name="aisle" style="width: 75%; max-width: 30px;" />
</div>
</div>
}

0 comments on commit 5048afb

Please sign in to comment.