phetsims / unit-rates

"Unit Rates" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 2 forks source link

Keypad accepts "." as a submission. #173

Closed phet-steele closed 7 years ago

phet-steele commented 7 years ago

@pixelzoom not sure if this sim is using its own keypad or not, so putting the issue in this repo.

You can submit "." as a keypad value. This produces "$NaN" as an answer for the question prompts or makes the marker editors unresponsive (depending on where "." was submitted). The only way to recover the marker editors is to click the marker refresh button.

Both screenshots taken after submitting ".":

screen shot 2017-03-07 at 10 37 18 am

Similar looking symptom as #149, but this is only because I entered "." before a valid value (which would have moved the marker):

screen shot 2017-03-07 at 10 37 21 am

Seen on macOS 10.12.3 Chrome. For phetsims/tasks/issues/797. URL: http://www.colorado.edu/physics/phet/dev/html/unit-rates/1.0.0-dev.68/unit-rates_en.html Version: 1.0.0-dev.68 2017-03-07 05:58:25 UTC Features missing: touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Language: en-US Window: 1920x1001 Pixel Ratio: 2/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 32 uniform: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 80) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {"assert":{"sha":"a707328c","branch":"master"},"axon":{"sha":"e0b1c391","branch":"master"},"babel":{"sha":"88805de4","branch":"master"},"brand":{"sha":"0be722ee","branch":"master"},"chipper":{"sha":"43ca9ac4","branch":"master"},"dot":{"sha":"16c2f26b","branch":"master"},"joist":{"sha":"695d3638","branch":"master"},"kite":{"sha":"f4c67cff","branch":"master"},"phet-core":{"sha":"c5c6c2a8","branch":"master"},"phetcommon":{"sha":"49b5cb0d","branch":"master"},"query-string-machine":{"sha":"d8a4ff18","branch":"master"},"scenery":{"sha":"04879a99","branch":"master"},"scenery-phet":{"sha":"0bb107fe","branch":"master"},"sherpa":{"sha":"98566566","branch":"master"},"sun":{"sha":"dc8dcfbf","branch":"master"},"tandem":{"sha":"45e9ee17","branch":"master"},"twixt":{"sha":"2ffed75c","branch":"master"},"unit-rates":{"sha":"4712352f","branch":"master"}}

pixelzoom commented 7 years ago

Thanks @phet-steele. The sim is still using the old NumberKeypad, since the next-gen keypad is not ready. The support for decimals in NumberKeypad was (quite obviously) never tested, guess I'm the guinea pig. I'll investigate how to work around this.

pixelzoom commented 7 years ago

This is a problem for all places where the keypad is used (marker editor and the Questions panel).

pixelzoom commented 7 years ago

Fixed in the above commit. I rewrote the validator to reject anything that is not a well-formed number. And '0' is still rejected by the marker editor, since we don't want to create markers at the origin.

@phet-steele Would you prefer to verify dev-test issues in a new dev version, or are you set up to test with master?

phet-steele commented 7 years ago

@pixelzoom fixes on master look great! No need to formally verify at a later date (since I just did).