Comments (3)
I'm going to assume that you're referring to the <<numberbox>>
macro that was first added to the standard library in v.2.32.0 and updated in v.2.33.0. I'll be referring to the latest public version.
I have some suggestions for improvements to this macro:
Considering that the macro's actual UI widget is an <input type="number">
element, most of your suggestions are probably going to need to be filed with (a) the standards groups and/or (b) the browser manufacturers. If I don't specifically reply to something below, then that's the case—or I consider it such, anyway.
Additionally. As is often the case, the <input type="number">
UI is not consistent across browsers, so some of your complaints are not cross-browser—in particular, Gecko and Blink have very different behavior here. E.g., Chrome does not allow any letters to be entered—aside from the scientific notation e
.
- It considers a decimal point to be an error unless it's .0 -- I think these should be configurable validation settings. Sometimes you want to real numbers, sometimes you only want integers.
- It doesn't let you specify a valid range -- I think more often than not, there is a valid range and an invalid range. It would be nice if the macro allowed you to specify it. You should not be able to use numbers outside of this range.
These are possible to address in SugarCube, but may not be in v2 due to argument list issues. Additionally, some, like range, can be checked by user code post-input.
- It saves a string into the variable, making it inconvenient to implement custom range validation. -- I think the variable should be a number type
I'm unsure what you think you're seeing, but it only stores numbers within the receiver variable. Beyond that, no browser that I know of writes non-numbers to the field value of an <input type="number">
, so <<numberbox>>
never even sees non-numbers to begin with.
from sugarcube-3.
Browsers (chiefly Firefox ) should no longer flag decimal numbers as invalid in the next release.
from sugarcube-3.
With the recent inputmode
change (commit tmedwards/sugarcube-2@a9984f9), I've done about as much as I can do for <<numberbox>>
in v2 without introducing breaking changes. Thus, I'm going to move this issue over to the v3 repo.
from sugarcube-3.
Related Issues (20)
- Printing undefined/null/NaN HOT 2
- Syntax Changes HOT 10
- Lightly used dialogs HOT 3
- Baseline browser support HOT 2
- Whitespace handling HOT 6
- Rethink problematic macros HOT 2
- Reconsidering the state history HOT 8
- History functions/methods should not consider the current moment HOT 1
- StoryInterface and references to default UI elements
- Add a "popout" window HOT 1
- Optional way to specify a <<radiobutton>> group
- Something like partial application for macro aliases
- CSS Sugarcube styling exclusion zone
- Custom spinner HOT 2
- UI Bar "Footer" passage HOT 1
- Asynchronicity and user APIs HOT 7
- Add support for RTL languages
- Update the documentation to show the internal StoryInterface passage HOT 1
- Add scopes to temporary variables
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sugarcube-3.