Closed Bug 1834141 Opened 3 years ago Closed 2 years ago

`oncancel` is undefined on `<dialog>` elements

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 114
defect

Tracking

()

VERIFIED FIXED
117 Branch
Tracking Status
firefox117 --- verified

People

(Reporter: rchristian, Assigned: vhilla)

References

Details

(Keywords: good-first-bug)

Attachments

(2 files)

Attached image ff_source.png

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0

Steps to reproduce:

Example HTML Doc:

<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        <div>
            <dialog id="dialog">
                <h1>Example Text</h1>
            </dialog>
            <button id="dialog-button">Show Dialog</button>
        </div>
        <script>
            const dialog = document.getElementById('dialog');
            const showDialogButton = document.getElementById('dialog-button');

            showDialogButton.addEventListener('click', () => dialog.showModal());

            dialog.addEventListener('cancel', () => console.log('cancel event'));
            dialog.addEventListener('close', () => console.log('close event'));

            console.log(`Dialog "oncancel" is: ${dialog.oncancel}`);
        </script>
    </body>
</html>

Actual results:

While the cancel event works as intended, oncancel is undefined, rather than null. This creates an issue in some UI frameworks that only attach the event when it can be found in the DOM.

Expected results:

oncancel should be null.

A friend did find the attached image in Firefox's source, which seems a bit odd. Something that fell through the gaps when implementing, perhaps?

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: `onchange` is undefined on `<dialog>` elements → `oncancel` is undefined on `<dialog>` elements
Assignee: nobody → vhilla
Status: NEW → ASSIGNED
Pushed by vhilla@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9aa4406273e8 Implement oncancel idl attribute. r=dom-core,webidl,saschanaz,edgar
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40867 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Upstream PR merged by moz-wptsync-bot
Regressions: 1841710

Reproduced the issue with Firefox 115.0a1 (2023-05-19) on Windows 10x64. Opening the HTML page from comment 0 will show Dialog "oncancel" is: undefined in the web console.
The issue is verified fixed with Firefox 117.0b6 on Windows 10x64, macOS 12 and Ubuntu 22. Dialog "oncancel" is: null message is displayed inside the web console when opening the HTML page.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: