Commit Graph
138 Commits
Author SHA1 Message Date
Keith Cirkel 527fa0b956 Bug 1963847 - Use ElementState::OPEN in Open() over GetBoolAttr() r=smaug
See: https://phabricator.services.mozilla.com/D235504#inline-1362631

Differential Revision: https://phabricator.services.mozilla.com/D247458
2025-05-02 10:36:00 +00:00
Keith Cirkel 9109fe9c9b Bug 1963791 - Throw when trying to show modal on inactive document r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D247447
2025-05-02 10:33:00 +00:00
keithamus a74f91b8cf Bug 1936940 - Implement dialog light dismiss r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235504
2025-05-01 19:05:50 +00:00
Sebastian Hengst ac85dfe9e5 Revert "Bug 1936940 - Implement dialog light dismiss r=webidl,emilio" for failing two html/semantics/interactive-elements/the-dialog-element/ tests
This reverts commit 0c65e1c7da.
2025-05-01 13:56:58 +00:00
keithamus 0c65e1c7da Bug 1936940 - Implement dialog light dismiss r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235504
2025-05-01 03:51:09 +00:00
Alexandru Marc ce0a455f47 Backed out changeset 307ff391dd02 (bug 1936940) for causing wpt failures @ dialog-closedby.html 2025-04-30 13:35:19 +03:00
keithamus 129d6b84a4 Bug 1936940 - Implement dialog light dismiss r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235504
2025-04-30 08:53:12 +00:00
keithamus 803154a9f6 Bug 1960556 - Implement Dialog requestClose r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D245566
2025-04-23 16:44:25 +00:00
pstanciu 97c7232c9d Backed out changeset 6bf58ecf3d6d (bug 1960556) for causing wpt failures on dialog-requestclose.html CLOSED TREE 2025-04-23 14:42:52 +03:00
keithamus 82d3e600e7 Bug 1960556 - Implement Dialog requestClose r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D245566
2025-04-23 08:25:14 +00:00
Jonathan Kew 6d25ae0f09 Bug 1936113 - Hook up :open to details, select, dialog, and input elements. r=webidl,emilio
Most of these elements are simple to support.

One slightly tricky item was <input type=date>, as testing indicates that the
front-end code usually (consistently?) hides the picker using setPickerState(),
which does not end up calling closeDateTimePicker() as might be expected.
So to properly track the open/closed state, I had to add a SetDateTimePickerState
webidl method, rather than just patching into the existing Open/Close calls.

Differential Revision: https://phabricator.services.mozilla.com/D234093
2025-01-17 13:49:56 +00:00
Butkovits Atila 530d9d432d Backed out 5 changesets (bug 1936113) for causing failures at select-inside-top-layer.tentative.html. CLOSED TREE
Backed out changeset 2b07b9e7bf57 (bug 1936113)
Backed out changeset a88e93dff614 (bug 1936113)
Backed out changeset 9cfc0a675a42 (bug 1936113)
Backed out changeset 716bdadbea2a (bug 1936113)
Backed out changeset 4ee0855e448f (bug 1936113)
2025-01-17 12:34:24 +02:00
Jonathan Kew a4d8e36aff Bug 1936113 - Hook up :open to details, select, dialog, and input elements. r=webidl,emilio
Most of these elements are simple to support.

One slightly tricky item was <input type=date>, as testing indicates that the
front-end code usually (consistently?) hides the picker using setPickerState(),
which does not end up calling closeDateTimePicker() as might be expected.
So to properly track the open/closed state, I had to add a SetDateTimePickerState
webidl method, rather than just patching into the existing Open/Close calls.

Differential Revision: https://phabricator.services.mozilla.com/D234093
2025-01-17 09:17:28 +00:00
keithamus d005787215 Bug 1925252 - Guard dialog toggle events from remove/showmodal r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D225949
2024-10-17 15:28:51 +00:00
Keith Cirkel 2a2c55a3ac Bug 1876762 - Implement togggle events for Dialog show/showModal/close r=smaug
https://github.com/whatwg/html/pull/10091

This also slightly refactors FireToggleEvent to allow to to
accomodate both popovers and now also dialogs

Differential Revision: https://phabricator.services.mozilla.com/D225449
2024-10-14 13:19:57 +00:00
keithamus a155da2430 Bug 1888728 - Use CloseWatcher machinery for Dialogs & Popovers r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D206170
2024-09-24 16:48:09 +00:00
keithamus bc09bf7036 Bug 1888776 - Add invoke defaults for dialog elements r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D206185
2024-05-24 09:48:49 +00:00
Emilio Cobos Álvarez bf22d33f87 Bug 1895208 - Refactor IsFocusable checks to take flags rather than bool arguments. r=smaug
This doesn't change behavior on its own, but it's likely we want to make
the tab focusability more complicated in bug 1895184, and this will make
changes to this area less painful.

Differential Revision: https://phabricator.services.mozilla.com/D209525
2024-05-06 21:54:37 +00:00
Emilio Cobos Álvarez 7506fc5879 Bug 1881011 - Refactor UnbindFromTree to take a context argument. r=smaug
Much like BindToTree.

This will be useful because I need to pass more information through
UnbindFromTree() to speed up dir=auto for bug 1874040.

Differential Revision: https://phabricator.services.mozilla.com/D202215
2024-02-20 15:05:40 +00:00
keithamus d5efc74a38 Bug 1878708 - Dialogs HideAllPopoversUntil nearest popover, not document. r=smaug
Given some markup like:

```html
<div id=popover popover>
  <button id="openDialog">Open Dialog</button>
  <dialog id=dialog>
    I'm a dialog!
  </dialog>
</div>
<button id="openPopover">Open Popover</button>
<button>I do nothing!</button>
```

With some JS like

```js
openDialog.onclick = () => {
  dialog.showModal();
}

openPopover.onclick = () => {
  popover.showPopover();
}
```

Clicking the "Open Popover" button followed by the "Open Dialog" button results in both the Dialog and Popover being hidden, however the dialog will still be open as modal, rendering the whole page inert, nothing is clickable and there seems to be no way to undo this (unless you use a CloseWatcher gesture such as the Esc key - if you have one available on your device).

It is expected that the popover should not close the dialog, as it causes the invisible Modal Dialog to make the whole page inert, and it is very difficult for users (and developers) to discover how to undo this action (pressing escape).

This was reported in https://github.com/whatwg/html/issues/9998, and WhatWG resolved to fix this, which in https://github.com/whatwg/html/pull/10116.

Differential Revision: https://phabricator.services.mozilla.com/D200686
2024-02-05 23:58:42 +00:00
Sandor Molnar bcd3a8272c Bug 1856109 - Fix build bustages on dom/html/HTMLDialogElement.cpp CLOSED TREE 2023-10-31 17:02:36 +02:00
Sean Feng 9b35d1887e Bug 1856109 - Allow <dialog> to move back to previously focused element even if they are in different BC r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190957
2023-10-31 13:55:05 +00:00
Natalia Csoregi 61ef694005 Backed out changeset 630864299a19 (bug 1856109) for causing Bug 1861451. CLOSED TREE 2023-10-27 17:19:52 +03:00
Ziran Sun 5fc0e2fb86 Bug 1858912 - Refine popover focusing steps to follow the specs. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190917
2023-10-27 13:02:17 +00:00
Sean Feng f278c53cd9 Bug 1856109 - Allow <dialog> to move back to previously focused element even if they are in different BC r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190957
2023-10-26 13:48:11 +00:00
Emilio Cobos Álvarez d02e297b2d Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Sean Feng 5b22ce2910 Bug 1811129 - Implement the new dialog initial focus algorithm r=emilio
The main changes of the new algorithm are

* Make the dialog focusing steps look at sequentially focusable elements instead of any focusable element.
* Make the dialog element itself get focus if it has the autofocus attribute set.
* Make the dialog element itself get focus as a fallback instead of focus being "reset" to the body element.

Spec PR (merged): https://github.com/whatwg/html/pull/8199

Differential Revision: https://phabricator.services.mozilla.com/D181263
2023-08-02 13:35:47 +00:00
Gregory Pappas 853e673a0f Bug 1842974 - Remove dom.dialog_element.enabled pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183711
2023-07-17 10:02:53 +00:00
Norisz Fay 984233a612 Backed out changeset cbf5ea1b17d2 (bug 1811129) for causing failures on modal-dialog-backdrop-opacity.html CLOSED TREE 2023-07-06 20:28:17 +03:00
Sean Feng c57066bb2b Bug 1811129 - Implement the new dialog initial focus algorithm r=emilio
The main changes of the new algorithm are

* Make the dialog focusing steps look at sequentially focusable elements instead of any focusable element.
* Make the dialog element itself get focus if it has the autofocus attribute set.
* Make the dialog element itself get focus as a fallback instead of focus being "reset" to the body element.

Spec PR (merged): https://github.com/whatwg/html/pull/8199

Differential Revision: https://phabricator.services.mozilla.com/D181263
2023-07-06 15:33:33 +00:00
Ziran Sun 57898e14ae Bug 1835464 - Check dialog is modal flag instead of open attribute in 'check popover validity' algorithm. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D181089
2023-06-20 08:49:32 +00:00
Cathie Chen 0bb97e3d56 Bug 1836057 - Popover: Use dialog initial focus for dialog popovers, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D179580
2023-06-01 18:16:53 +00:00
Ziran Sun c1241f9987 Bug 1834519 - Don't throw when popovers/dialogs are in requested state. r=emilio
Update to be in line with spec discussions at
https://github.com/whatwg/html/pull/9142

Differential Revision: https://phabricator.services.mozilla.com/D178782
2023-05-25 08:35:29 +00:00
Ziran Sun a716d1e6ed Bug 1831057 - Handle conflict interactions between popover, modal dialog and fullscreen. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177003
2023-05-17 18:49:45 +00:00
Stanca Serban 95ee09b30b Backed out changeset e1a398764f9e (bug 1831057) for causing wpt failures in popover-top-layer-combinations.html. 2023-05-12 15:39:38 +03:00
Ziran Sun 5bff97d750 Bug 1831057 - Handle conflict interactions between popover, modal dialog and fullscreen. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177003
2023-05-12 08:00:26 +00:00
Ziran Sun a1e6bb46ed Bug 1829318 - Throw exception when calling dialog.show() on an open popover. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D176141
2023-04-28 14:17:51 +00:00
Cathie Chen b3a9e14892 Bug 1823897 - Implement popover focusing steps, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173714
2023-03-28 16:01:25 +00:00
Sean Feng 88af473516 Bug 1809561 - Check IsInProcess() before calling SameOriginWithTop() for <dialog> r=smaug
Looks like in an edge case, this method could be called on a
out-of-process browsing context.

Differential Revision: https://phabricator.services.mozilla.com/D171766
2023-03-07 14:26:14 +00:00
Sean Feng 3630c2abf3 Bug 1741936 - Implement focus delegate algorithm r=emilio
Spec: https://html.spec.whatwg.org/multipage/interaction.html#focus-delegate

Differential Revision: https://phabricator.services.mozilla.com/D153689
2022-10-14 01:20:08 +00:00
Emilio Cobos Álvarez c72c6c699f Bug 1771150 - Make fullscreen modal. r=smaug
As per https://github.com/w3c/csswg-drafts/issues/7311.

Differential Revision: https://phabricator.services.mozilla.com/D150335
2022-07-06 00:16:28 +00:00
Noemi Erli d0804517c7 Backed out changeset 8a9bae22cf24 (bug 1771150) for causing failures in browser_fullscreen_warning.js and test_pointerlock-api.html CLOSED TREE 2022-06-27 17:27:11 +03:00
Emilio Cobos Álvarez 76a4994d7c Bug 1771150 - Make fullscreen modal. r=smaug
As per https://github.com/w3c/csswg-drafts/issues/7311.

Differential Revision: https://phabricator.services.mozilla.com/D150335
2022-06-27 10:57:34 +00:00
Emilio Cobos Álvarez 1c58e2a928 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Masayuki Nakano 60e856a8ab Bug 1680611 - part 8: Mark nsFocusManager::Blur and its callers in nsFocusManager as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147067
2022-05-26 04:37:20 +00:00
Emilio Cobos Álvarez e51b1c04e0 Bug 1771137 - Cleanup a bit top layer code. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D147282
2022-05-25 13:07:19 +00:00
Emilio Cobos Álvarez 3ab2050fc5 Bug 1743082 - Only clear focus for modal dialog. r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D134964
2022-01-03 19:31:57 +00:00
Olli Pettay 7e08a9c5f4 Bug 1740971, use a raw pointer for fast iteration, r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D131085
2021-11-15 13:13:47 +00:00
Sean Feng 1d5b97f1cd Bug 1709233 - Fix a null pointer crash in HTMLDialogElement::StorePreviouslyFocusedElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D114256
2021-05-04 18:39:04 +00:00
Sean Feng eeab40a6f4 Bug 1660271 - Move the focus to the previously focused element when <dialog> is closed r=smaug
This change is based on the latest changes for the <dialog> element in
https://github.com/whatwg/html/pull/6531, such that closing
<dialog> should move the focus to the previously focused element.

Differential Revision: https://phabricator.services.mozilla.com/D109726
2021-04-29 19:35:23 +00:00