Closed Bug 1478102 Opened Last year Closed 8 months ago

can't type on numbers fields on two of my banks after latest update (nightly)


(Core :: DOM: Events, defect, P3)

63 Branch



Tracking Status
firefox-esr60 --- unaffected
firefox63 + wontfix
firefox64 + disabled
firefox65 + verified


(Reporter: gabriel2007, Assigned: masayuki)



(Keywords: regression)


(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
Build ID: 20180724100052

Steps to reproduce:

Tried to type an amount to make a transfer on my bank

Actual results:

Can't type on that box

Expected results:

number should have been allowed to be typed as it used to be before the update
Please provide the detailed steps to reproduce, which bank website, how to enter.
Flags: needinfo?(gabriel2007)
(In reply to YF (Yang) from comment #1)
> Please provide the detailed steps to reproduce, which bank website, how to
> enter.

This is the source code of the area, if you want the whole page I can save it, the problem is in a private section so I can't give you that info

<table class="TMNavInfo" cellspacing="0" cellpadding="0">
		<td style="width: 0.2px;">
			<div class="ConDiv">
					<div class="icon-exclamacion" style="color: #FFFFFF; font-size: 26px; background: #CC0000; position: relative; top: 15%"></div>
		<td style="width: 98%">
			<div class="ConDivTx"></div>
		<td colspan="2">
			<div class="InfoDiv">
				Esta opción le permite realizar transferencias en línea a Cuentas Banesco de Terceros, para lo cual debe poseer la Clave de Operaciones Especiales.<br><br>Por su seguridad lo contactaremos vía telefónica para confirmar ciertas transacciones.<br><br><b>Recuerde verificar que todos los datos estén correctos, antes de presionar "Aceptar".</b><br><br><b>Nota: Ud. no podrá realizar pagos de Servicios a través de esta opción.</b><br><br><b>
<table style="height: 20px;">
<table class="TM"><tbody><tr><td class="HmGVTltWidth"></td><td class="HmGVTltSup">Código cuenta cliente a debitar</td><td class="HmGVTltWidth"></td></tr></tbody></table>

				<table class="TDat">
							<select name="ctl00$cp$wz$ddlCuentaDebitar" id="ctl00_cp_wz_ddlCuentaDebitar" class="DefDdl" onchange="SetCompareValidator('ctl00_cp_wz_ddlCuentaDebitar', 'ctl00_cp_wz_txtMonto_LTVal', 'ctl00_cp_wz_lblSaldoDisp');">
			<option value=""></option><option value="4|9.239.858,39">0134-****-**-***2135464 Cuenta de Ahorros</option><option value="5|956.526.138,24">0134-****-**-***1234567 Cuenta Corriente C/Intereses</option><option value="6|12.848.960,41">0134-****-**-***1234567 Cuenta Corriente C/Intereses</option>
							<span id="ctl00_cp_wz_ctl02" style="color:Red;margin-left:2px;display:none;">*</span>
					<tr><td>Saldo Disponible:&nbsp;<span id="ctl00_cp_wz_lblSaldoDisp" class="Neg"></span></td></tr>
<table class="TM"><tbody><tr><td class="HmGVTltWidth"></td><td class="HmGVTltSup">Datos de la transferencia</td><td class="HmGVTltWidth"></td></tr></tbody></table>

				<table class="TDat">
					<tbody><tr><td colspan="2" class="NoBr">Haga click en el directorio para seleccionar los datos de la transferencia:<input type="button" value="Directorio" onclick="AbrirDirectorio('../AdministracionDirectorios/IndividualTran.aspx?Id=' + GetCuentaID(ctl00_cp_wz_ddlCuentaDebitar.value));" class="Bal"></td></tr>
						<td style="width:40%">Código Cuenta Cliente o Tarjeta Electrónica a Transferir:</td>
						<td style="width:60%">
							<input name="ctl00$cp$wz$txtCuentaTransferir" type="text" maxlength="20" id="ctl00_cp_wz_txtCuentaTransferir" class="DefTxt" onkeypress="return onlyDigits(event, this.value,false,false,false,',','.',0);" size="22" style="background-image: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAAAXNSR0IArs4c6QAAAUBJREFUOBGVVE2ORUAQLvIS4gwzEysHkHgnkMiEc4zEJXCMNwtWTmDh3UGcYoaFhZUFCzFVnu4wIaiE+vvq6+6qTgthGH6O4/jA7x1OiCAIPwj7CoLgSXDxSjEVzAt9k01CBKdWfsFf/2WNuEwc2YqigKZpK9glAlVVwTTNbQJZlnlCkiTAZnF/mePB2biRdhwHdF2HJEmgaRrwPA+qqoI4jle5/8XkXzrCFoHg+/5ICdpm13UTho7Q9/0WnsfwiL/ouHwHrJgQR8WEwVG+oXpMPaDAkdzvd7AsC8qyhCiKJjiRnCKwbRsMw9hcQ5zv9maSBeu6hjRNYRgGFuKaCNwjkjzPoSiK1d1gDDecQobOBwswzabD/D3Np7AHOIrvNpHmPI+Kc2RZBm3bcp8wuwSIot7QQ0PznoR6wYSK0Xb/AGVLcWwc7Ng3AAAAAElFTkSuQmCC&quot;); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;" autocomplete="off"><span id="ctl00_cp_wz_txtCuentaTransferir_ReqVal" style="color:Red;display:none;margin-left:2px;;">*</span><span id="ctl00_cp_wz_txtCuentaTransferir_RegVal" style="color:Red;display:none;margin-left:2px;;">*</span>
							<span id="ctl00_cp_wz_ctl07" style="color:Red;margin-left:2px;display:none;">*</span>
							<span id="ctl00_cp_wz_cvNoBancaComYOtras" style="color:Red;margin-left:2px;visibility:hidden;">*</span>
						<td><input name="ctl00$cp$wz$txtBen" type="text" maxlength="30" id="ctl00_cp_wz_txtBen" class="DefTxt" size="32"><span id="ctl00_cp_wz_txtBen_ReqVal" style="color:Red;display:none;margin-left:2px;;">*</span><span id="ctl00_cp_wz_txtBen_RegVal" style="color:Red;display:none;margin-left:2px;;">*</span></td>
						<td>Cédula/RIF asociada a la Cuenta Cliente o Tarjeta Electrónica:</td>
							<select name="ctl00$cp$wz$ddlNac" id="ctl00_cp_wz_ddlNac" class="DefDdl">
			<option value="" selected="selected"></option><option value="V">V</option><option value="E">E</option><option value="J">J</option><option value="P">P</option><option value="G">G</option>
		</select><span id="ctl00_cp_wz_RequiredFieldValidator1" style="color:Red;margin-left:2px;visibility:hidden;">*</span>
							<input name="ctl00$cp$wz$txtCedula" type="text" maxlength="9" id="ctl00_cp_wz_txtCedula" class="Cedula" onkeypress="return onlyDigits(event, this.value,true,true,true,',','.',2);" size="11"><span id="ctl00_cp_wz_txtCedula_ReqVal" style="color:Red;display:none;margin-left:2px;;">*</span><span id="ctl00_cp_wz_txtCedula_RegVal" style="color:Red;display:none;margin-left:2px;;">*</span>
						<td><input name="ctl00$cp$wz$txtMonto" type="text" maxlength="19" id="ctl00_cp_wz_txtMonto" class="DefTxt" onblur="this.value=formatMoneda(this.value,',','.',2);" onkeyup="formatMoneda(this.value,',','.',2);" onkeypress="return onlyDigits(event, this.value,true,true,true,',','.',2);" size="21"><span id="ctl00_cp_wz_txtMonto_ReqVal" style="color:Red;display:none;margin-left:2px;;">*</span><span id="ctl00_cp_wz_txtMonto_RegVal" style="color:Red;display:none;margin-left:2px;;">*</span><span id="ctl00_cp_wz_txtMonto_LTVal" style="color:Red;display:none;">*</span><span id="ctl00_cp_wz_txtMonto_GTVal" style="color:Red;display:none;">*</span></td>
						<td><input name="ctl00$cp$wz$txtConcepto" type="text" maxlength="40" id="ctl00_cp_wz_txtConcepto" class="DefTxt" onkeydown="if(event.which || event.keyCode){if((event.which == 13) || (event.keyCode == 13)) {if(document.getElementById('ctl00_cp_wz_StartNavigationTemplateContainerID_btnNext')) document.getElementById('ctl00_cp_wz_StartNavigationTemplateContainerID_btnNext').click();return false; }} else {return true};" size="42" data-com.bitwarden.browser.user-edited="yes"><span id="ctl00_cp_wz_txtConcepto_RegVal" style="color:Red;display:none;margin-left:2px;;"></span></td>
				<div id="ctl00_cp_wz_ctl12" class="DefSm" style="color:Red;display:none;">

Flags: needinfo?(gabriel2007)
Unfortunately, I failed to reproduce the problem with the above code, Nightly 63.0a1 (20180725103029) on Win10.

Can you indicate which bank? Just the domain that this problem occurs with.
Component: Untriaged → Layout: Form Controls
Product: Firefox → Core
Another super-helpful thing would be to find the regression range:

Let me know if you'd need any help with that.
Priority: -- → P3
Same problem here since 63.0.

Here is an example of field that is not modifiable anymore :
<input	id="numvoie"
	      			onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" 

If I empty the keypress attribute, I can type numbers again.
Attached file testcase
Thanks for that test-case!
Attachment #9020774 - Attachment mime type: text/plain → text/html
There are various things that have happened relatively to keypress events in 63. Also there's window.event and such.
Component: Layout: Form Controls → DOM: Events
Ever confirmed: true
Flags: needinfo?(masayuki)
This one was regressed by bug 1452569.
Blocks: 1452569
Flags: webcompat?
Flags: needinfo?(alchen)
[Tracking Requested - why for this release]: Compat regression.
Bug 1452569 implement event.returnValue.
So "event.returnValue = false" don't have any effect before.

Does this make sense if the code is revised to the following?
<input onKeypress="if (event.keycode && (event.keyCode < 45 || event.keyCode > 57)) event.returnValue = false;">
Flags: needinfo?(alchen)
Why other browsers have no problem? Due to poor sniffing?
The testcase I uploaded works in WebKit / Chrome, so that's why I ni?d Masayuki regarding keyCode.
Yeah, in Gecko keyCode is always zero. I guess this is bug 1479964.
Blocks: 1479964
And thus should be fixed by bug 1502795.
Depends on: 1502795
In FireFox, there is no "keycode" in the "keypress" event.
However, there is "keycode" in "keydown" event.

So the following is also works.
<input onKeydown="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
No longer blocks: 1479964
No longer depends on: 1502795
Blocks: 1479964
Depends on: 1502795
The problem does not seem to be related to returnValue. The problem seems to be related to keyCode and onKeyPress as FF63 returns 0 for all keys when using onKeyPress.

Here is my test case that fails in FF63 but works in GC70:
<input type="text" onKeyPress="if(event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;">

What is the recommended fix? Will FF release an immediate update to allow this code to keep working? This completely breaks our website for FF users.

We can't just change onKeyPress to onKeyDown, it does not have the same behavior or results and it won't work. For the same reason, using "key" instead of "keycode" will not work.
If you need an immediate workaround, something like <input type="text" onKeyPress="if((event.keyCode || event.charCode) < 48 || (event.keyCode || event.charCode) > 57) event.returnValue = false;"> will do it.

Is there any reason you can't use event.key?
Flags: needinfo?(mikebaretta)
Yeah, in these days, the keypress event handler should be:

if (/^[0-9]$/.test(event.key)) {

KeyboardEvent.key is available on most modern browsers now.

Anyway, this is not enough for input from IME, paste, d&d, etc, though. Perhaps, you want to do:

  if (event.isComposing) {
  if (!/$[0-9]*^/.test( { =;
  } else { =;
Flags: needinfo?(masayuki)
Well, it's important for us that this regression can be fixed as soon as possible.
We can't fix that old school code easily, because our customers use different versions of our product.
Our customers may use FF, FF ESR, IE, Chrome but switching from a browser to another can be very tricky and in some cases impossible in the short term.

So please, is it possible to hope a fix soon ?

Thanks a lot for you job.
Perhaps, not so soon since we confirmed that some websites are broken with enabling the fix of bug 1479964. We need to wait such websites fix their bug.
Thank you for your help Masayuki.

Can you provide simple code to allow numbers plus all command and navigation keys?

We want to allow numbers 0-9 (from both top of keyboard and number pad) as well Backspace, Delete, Home, End, all Arrows (Left, Right, Up, Down), and Tab.

We want to block all letters, symbols, spaces.

We're really just looking at keyboard input - we can ignore cut & paste, drag & drop, etc.

We need simple code that works on all current browsers (FF, Chrome, Safari, IE11, Edge) and can be placed within the <input> tag using onKeyPress attribute.

I agree that e.key is probably better than e.keyCode, but there are a few differences among browsers (specifically the key given for certain Command keys in IE).

If you think FF will revert this issue in a matter of days then I won't worry about it. But if not then I would greatly appreciate a new coding solution.

Thank you!
Flags: needinfo?(mikebaretta)
@miketbaretta, shouldn't comment #17 work for you? As long as you're checking `event.keyCode || event.charCode`, it should work as expected.
@Mike Taylor

Comment #17 doesn't allow use of Command of Navigation keys.

You see, in GC and IE the Command and Navigation keys do not trigger an onKeyPress event, so they are given a "pass" and will work. I assume that this was also the case with FF62, but now with FF63 the Command and Navigation keys trigger onKeyPress and thus Comment #17 doesn't work.
Meant to write "doesn't allow use of Command *or* Navigation keys."
firefox63 wontfix
Really ?

Does it means no patch before FF64 release (dec 11th) ?
wontfix might have been a bit premature, but the lack of an assignee or patch doesn't make it seem very likely that a fix will materialize in time for an out-of-band bugfix release for Fx63 either.
Flags: needinfo?(gabriel2007)
Here's what I came up with, please tell me if you think this will work in FF63 and all proposed/known future FF versions:

<input name="Quantity" type="text" onKeyPress="if((event.charCode >= 48 && event.charCode <= 57) || (event.charCode == 0)) {return true;} else {event.preventDefault();}">

The purpose of this is to allow only numbers to be keyed/entered, but to also allow all Command and Navigation keys.

I took advantage of the fact that FF63 uses a charCode of 0 for all Command and Navigation keys. Will FF continue to do this or is it in jeopardy? (As I mentioned previously, GC and IE do not trigger an onKeyPress event at all for Command and Navigation keys.)

Thank you!
ni? masayuki for the question in comment #27.
Flags: needinfo?(masayuki)
When we fix bug 1502795 in release channel, bug 968056 (and bug 354358) are also fixed in release channel because some frameworks depend on bug 968056 and we want to reduce change cost of web developers.
Flags: needinfo?(masayuki)
I understand that this report comes a bit late, considering the work done in the meantime, but you should know that not resolving this problem early requires us to redirect our users to GC or IE (if possible).

So please, do your best to patch this rapidly.

Thank you.
(In reply to Laurent Barbareau from comment #30)
> I understand that this report comes a bit late, considering the work done in
> the meantime, but you should know that not resolving this problem early
> requires us to redirect our users to GC or IE (if possible).
> So please, do your best to patch this rapidly.
> Thank you.

Laurent, can you email me at I'm happy to help you come up with a workaround for your users.
Flags: needinfo?(lbarbareau)
Wontfix for 63 as we are unlikely to have another dot release before 64 ships.
Depends on: 1510985
Can we please confirm the current status of this bug? We'll be fixing it in 64 via bug 1510985 and for 65+ we've got other patches landed which address this issue?
Flags: needinfo?(masayuki)
I will let Masayuki also reply, but yes that is correct. The 65+ bug is 1496288.
In 64, we'll disable Event.returnValue temporarily for this bug. And in 65, we'll ship all new keyboard event behaviors so that this is also "fixed" in 65 even though Event.returnValue is available again in 65.
Flags: needinfo?(masayuki)
See Also: → 1496288
Disabled in 64 by 1510985
So it won't be fixed before 2019-01-29 ?... :roll:
Will it be fixed into 65 for sure or there are still some uncertainties ?
Flags: needinfo?(lbarbareau)
In 64, returnValue is temporarily disabled. Then, in 65, it'll be enabled again with changes of keypress event behavior.
Laurent, my understanding is that Firefox 65 (currently on Beta) contains the fixes needed for things to Just Work. It would be nice if we could verify that prior to next month's release, however, so we don't find ourselves scrambling at the last second to fix any remaining issues :). Are you able to confirm that the current Beta release works as expected for you?
Flags: needinfo?(lbarbareau)
In our opinion this is not the kind of regression with which you can decide to postpone the fix, whatever the difficulties to deal with... Some of our customers are quite angry because of this. We've advised them to switch to another browser or FF ESR, but this is not something a final user can always do himself (because of rights/policy).

Our application has been rid of the onkeypress attribute issue (50 occurrences), but this will be effective only when we could deploy a new version for each of our customers, that is absolutely not something we can decide alone.
That means we're still awaiting the fix as soon as possible because some of our customers have to switch between browsers according what they have to do.

I add that a coworker of mine said it wasn't the first time this issue occurred with the onkeypress attribute, so maybe you could set up non-regression tests to prevent this definitely.
Flags: needinfo?(lbarbareau)
I'm not sure what you're talking about in comment 40.  We believe this is fixed both in firefox 64 (current release) and 65 (current beta).
Ok... after some tries with FF64 and FF65, here is the translation of your "In 64, returnValue is temporarily disabled" :
- In FF64 you are no longer prevented from typing characters into the fields where onkeypress attribute is supposed to control which characters are accepted and which ones are not. But you can type any character, the control is not effective. 
- In FF65, everything seems to be back in order.

So, at least users are not blocked. Thank you.
Thanks for confirming. Glad to hear we're all on the same page now! Calling this fixed for 65+.
Assignee: nobody → masayuki
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65

I have reproduced this issue using Firefox 64.0a1 (2018.10.18) on Win 10 x64.
I can confirm this issue is fixed, I verified using Firefox 65.0 on Win 10 x64, Mac OS X 10.13 and Ubuntu 18.04 x64 using the attached testcase, now in FF 65.0 in that box you can type any character this is expected?

Flags: needinfo?(masayuki)

(In reply to Timea Zsoldos [:zstimi/tzsoldos], Desktop Release QA from comment #44)

now in FF 65.0 in that box you can type any character this is expected?

Yes, it is. For restricting the acceptable characters, it uses Event.returnValue, but this is disabled at release of 65 due to bug 1514940. Sorry for really complicated status of these bugs.

Flags: needinfo?(masayuki)
You need to log in before you can comment on or make changes to this bug.