mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Vue kit: UiDialog for the Data Library and scene sharing dialogs
UiDialog is a native <dialog> its owner opens and closes with open: true opens it with showModal() (on mount, for one mounted open), false closes it, and unmounting closes it. Each change is applied once the content has rendered and then emitted as opened or closed, so the Data Library still focuses its search field on open and returns focus to Browse on close. Escape's cancel is prevented and emitted as dismiss; backdropDismiss makes a click on the dialog itself a dismiss too, as the Data Library's was. When the browser closes the dialog on its own while open is still true, browserClose tells the owner, as the Data Library's close listener did; closing on unmount reports nothing. A DOM without showModal() leaves it closed. Attributes, classes, styles and listeners go to the dialog, and element is exposed. The two dialogs share no declarations, so there are no kit rules. dialogs.test.mjs fails if a view writes a <dialog> by hand; the panels drawn as role="dialog" are other controls. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
2d7b7be890
commit
ec4a5b6afe
10 files changed
+388
-42
No files matched your search
@@ -139,6 +139,30 @@ test('Browse opens a modal on the search field, packs last; Escape returns to Br
|
||||
assert.equal(document.activeElement, $('#data-library-browse'));
|
||||
});
|
||||
|
||||
test('a backdrop click and a close the browser made itself return to Browse', async (t_) => {
|
||||
const { owner } = mount(t_);
|
||||
owner.open();
|
||||
await settle();
|
||||
$('#data-library .data-library-intro').click();
|
||||
await settle();
|
||||
assert.equal($('#data-library').open, true, 'a click inside keeps it open');
|
||||
$('#data-library').click();
|
||||
await settle();
|
||||
assert.equal($('#data-library').open, false);
|
||||
assert.equal(document.activeElement, $('#data-library-browse'));
|
||||
owner.open();
|
||||
await settle();
|
||||
assert.equal(document.activeElement, $('#data-library input[type="search"]'));
|
||||
// An Escape the page may not cancel: the browser closes it first.
|
||||
$('#data-library').close();
|
||||
await settle();
|
||||
assert.equal($('#data-library').open, false);
|
||||
assert.equal(document.activeElement, $('#data-library-browse'));
|
||||
owner.open();
|
||||
await settle();
|
||||
assert.equal($('#data-library').open, true, 'the owner closed it too');
|
||||
});
|
||||
|
||||
test('filters narrow the list as the viewer types and picks', async (t_) => {
|
||||
const { owner } = mount(t_);
|
||||
owner.open();
|
||||
|
||||
Reference in new issue
Block a user