Permalink
Browse files

Switch from using inputs with a type of number (too restrictive, has …

…weird side-effects). Do some reformatting of the software keyboard, as well.
  • Loading branch information...
1 parent 537dcff commit 0c491b01881b033e37f1745cfd9c072a6c3c6295 @jeresig jeresig committed Oct 25, 2011
Showing with 10 additions and 11 deletions.
  1. +1 −1 css/khan-exercise.css
  2. +1 −1 utils/answer-types.js
  3. +8 −9 utils/software-keyboard.js
View
2 css/khan-exercise.css
@@ -294,7 +294,7 @@ div.timeline-total {
}
}
-.lite #solutionarea input[type=number] {
+.lite #solutionarea input.number {
font-size: 16px;
text-align: right;
View
2 utils/answer-types.js
@@ -392,7 +392,7 @@ jQuery.extend( Khan.answerTypes, {
var input;
if ( typeof userExercise !== "undefined" && userExercise.tablet ) {
- input = jQuery("<input type='number'/>");
+ input = jQuery("<input type='text' class='number'/>");
}
return Khan.answerTypes.text( solutionarea, solution, fallback, verifier, input );
View
17 utils/software-keyboard.js
@@ -1,17 +1,16 @@
jQuery.fn["software-keyboardPost"] = function() {
- var softwareKeyboard = jQuery( "#software-keyboard" );
- var solutionarea = jQuery("#solutionarea");
-
- var inputs = solutionarea.find( ":input" );
- inputs.prop( "readonly", true )
- .css( "-webkit-tap-highlight-color", "rgba(0, 0, 0, 0)" );
+ var softwareKeyboard = jQuery( "#software-keyboard" ),
+ solutionarea = jQuery( "#solutionarea" ),
+ inputs = solutionarea.find( ":input" )
+ .prop( "readonly", true )
+ .css( "-webkit-tap-highlight-color", "rgba(0, 0, 0, 0)" ),
+ field = inputs.first();
var keyPressed = function( key ) {
- var field = solutionarea.find( ":input" ).first();
-
// Normal key
- if ( key.length === 1 ) {
+ if ( key !== "bs" ) {
field.val( field.val() + key );
+
} else {
// Assume for now that it is backspace
field.val( field.val().slice( 0, -1 ) );

0 comments on commit 0c491b0

Please sign in to comment.