Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Dialog validation works ven when canceling

  • The automatic validation of dialog's form works even when canceling validation.
    Then this forbid closing the dialog, the only way being entering correct inputs (which validates) and clicking Cancel).
    Obviously input datas validation should not operate when canceling .
    This bug is on Opera, Opera Next and Opera DEv.
    The test case :
    <!doctype html>
    <html lang="en">
    <meta charset="UTF-8" />
    <title>dialog test-case</title>
    window.addEventListener('load', start, false);
    var dialog_elt;
    function start(e) {
    dialog_elt = document.getElementById('dialog');
    function showModalDialog() {
    dialog_elt.addEventListener('close', dialogPersonsAddConfirm, false);
    function dialogPersonsAddConfirm(e) {
    if ( == 'yes') {
    console.log("dialogPersonsAddConfirm(e) -> returnValue = '" + + "'");
    } else {
    console.log("dialogPersonsAddConfirm(e) -> returnValue = '" + + "'");
    <button onclick='showModalDialog();'>Show modial dialog</button>
    <dialog id="dialog">
    <form method="dialog">
    <label for="firstname">Firstname : </label>
    <input type='text' id='firstname' name='firstname' placeholder="Enter first name" required />
    <label for="lastname">Lastname : </label>
    <input type='text' id='lastname' name='lastname' placeholder="Enter last name" required />
    <label for="email">Email :</label>
    <input type='email' id='email' name='email' placeholder="Enter email"/>
    <p><button type="submit" value="no" autofocus>Cancel</button><button type="submit" value="yes">OK</button>