It’s really quite strange but when you use a “number” input field in Firefox, then validate it with RegEx, it totally flips out.<p>I can provide examples but I guess my question is, is it worth reporting these? Or will it just never get fixed?<p>Edit: spellcheck
IMHO, it's worth reporting, but temper your expectations of it being fixed. I've seen clearly written, easily reproduced, possibly easily fixed bugs linger in Bugzilla for decades. At Mozilla and other organizations using bugzilla and other trackers.<p>Spend a day turning this into a bug report that's up to the standards of Mozilla; <i>maybe</i> another day trying to track down the behavior and suggest a patch. File the bug, and maybe the patch, and then implement a work around and go on with your life. Sure, watch for replies and try to respond in a timely fashion, but don't expect anything.<p>That said, I've put in a bugzilla bug and it got fixed in a reasonable time and then pushed in the next eligible release; <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1740856" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=1740856</a> but it was widely applicable, and the observed behavior was clearly broken, but details were hard to observe for many (which is why effects from the bug were observed but not diagnosed in related bugs)
I am not super good at this and only using half my brain, but I did my best attempt to convert this to vanilla JavaScript and get seemingly odd results.<p><pre><code> <!DOCTYPE html>
<input type="number" id="progress" class="form-control mr-0 pr-0" placeholder="Progress (%)" />
<script>
document.getElementById('progress').addEventListener('change', function() {
console.log("fired!");
// Remove any non-numeric.
let val = this.value.replace(/[^0-9.]/g, '');
// Only one decimal point.
let parts = val.split('.');
if (parts.length > 2) {
val = parts[0] + '.' + parts.slice(1).join('');
}
let numVal = parseFloat(val) || 0;
if (numVal > 100) {
numVal = 100;
} else if (numVal < 0) {
numVal = 0;
}
this.value = numVal === 0 ? '' : numVal;
});
</script>
</code></pre>
Someone educate me, especially if I am off base or the code is inherently incorrect.
Yes, you should report it. I've reported several Firefox bugs and the tickets often spring to life suddenly after several years of sitting there unaddressed. It makes life much easier for the developers if you include a clean, easy-to-reproduce test case.
Honestly, you could have spent the time you used to write this post and comments on making the report instead.<p>You basically wrote the entire bug report here, instead of doing it on Bugzilla.