Opened 12 years ago

Closed 12 years ago

#7577 closed bug (cantfix)

Opera restores numeric <input> value after opening dialog, if value was cleared when dialog is closed

Reported by: jmabey Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.dialog Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:

Description

Suppose a dialog contains a numeric field (<input type="number">) and this field's value is set to an empty string whenever the dialog is closed. When the dialog is opened again, instead of the field's value being empty, it is set to whatever it was before being set to empty. This only happens with Opera.

For example:

  • User opens dialog and types "1234" into numeric field
  • User closes dialog and field is cleared
  • User opens dialog and the field's value is "1234", despite being set to empty

Test case: http://jsfiddle.net/jmabey/he6aQ/

  • Reproducible with Opera 11.50 in Ubuntu 11.04 and Windows 7. Not reproducible with Firefox 3.6 and 5, Chrome 12, or IE 7 to 9.
  • Reproducible with jQuery UI v1.8.6 to v1.8.14. Not reproducible with v1.8.5.

Change History (3)

comment:1 Changed 12 years ago by tj.vantoll

This seems to be a really odd Opera bug rather than a jQuery / jQuery UI problem. I was able to further minify the problem down and I was able to recreate the issue with the following plain old JS:

<!-- HTML -->
<input type="number" id="num1" value="123" />

/* JS */
document.getElementById('num1').style.display = 'none';
setTimeout( function()  {
    document.getElementById('num1').value = '';
    document.getElementById('num1').style.display = 'inline';
}, 20);

You would think this would also reproduce it but it doesn't.

<!-- HTML -->
<input type="number" id="num1" value="123" />

/* JS */
document.getElementById('num1').style.display = 'none';
document.getElementById('num1').value = '';
document.getElementById('num1').style.display = 'inline';

I created a jsFiddle to demonstrate this - http://jsfiddle.net/HFeqS/4/. The odd behavior still only occurs in Opera. This bug could probably be closed and something could be opened in Opera's bug tracker.

comment:2 Changed 12 years ago by Scott González

Thanks for reducing this. I've filed a bug with Opera. We'll see if they have any workarounds, but I have a feeling this will get closed as cantfix.

comment:3 Changed 12 years ago by Scott González

Resolution: cantfix
Status: newclosed

Opera has fixed the bug (that was quick!). It's probably too late for the fix to go into 11.60, but should be available in 12.00. It doens't look like there's anything that we can or should be doing in dialog.

Note: See TracTickets for help on using tickets.