anentrypoint-design 0.0.378 → 0.0.380
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/community.css +8 -0
- package/dist/247420.css +8 -0
- package/dist/247420.js +25 -25
- package/package.json +1 -1
- package/src/components/editor-primitives.js +14 -5
- package/src/components/overlay-primitives.js +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anentrypoint-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.380",
|
|
4
4
|
"description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/247420.js",
|
|
@@ -509,7 +509,10 @@ export function ContextMenu({ items = [], anchor = { x: 0, y: 0 }, onClose } = {
|
|
|
509
509
|
// Re-clamp on resize/orientation change for the menu's lifetime.
|
|
510
510
|
window.addEventListener('resize', clamp);
|
|
511
511
|
el._dsCtxClampOff = () => { window.removeEventListener('resize', clamp); el._dsCtxClampOff = null; };
|
|
512
|
-
|
|
512
|
+
// setTimeout(0), not queueMicrotask: the triggering contextmenu/click
|
|
513
|
+
// event's own default focus can otherwise win the race and leave focus
|
|
514
|
+
// outside the menu, breaking keyboard arrow-nav/Escape.
|
|
515
|
+
setTimeout(() => { el.querySelector('button[data-ix]')?.focus(); }, 0);
|
|
513
516
|
}
|
|
514
517
|
},
|
|
515
518
|
...items.map((it, i) => it.separator
|
|
@@ -581,10 +584,12 @@ export function Drawer({ side = 'left', open = false, onClose, children, ariaLab
|
|
|
581
584
|
if (!el || el._dsTrap) return;
|
|
582
585
|
el._dsTrap = true;
|
|
583
586
|
el.addEventListener('keydown', (e) => trapTabKey(el, e));
|
|
584
|
-
|
|
587
|
+
// setTimeout(0), not queueMicrotask — see Dialog's identical comment
|
|
588
|
+
// below: the opening click's own default focus can win a same-tick race.
|
|
589
|
+
setTimeout(() => {
|
|
585
590
|
const f = el.querySelector(FOCUSABLE_SEL);
|
|
586
591
|
(f || el).focus();
|
|
587
|
-
});
|
|
592
|
+
}, 0);
|
|
588
593
|
},
|
|
589
594
|
}, ...kids(children))
|
|
590
595
|
);
|
|
@@ -616,10 +621,14 @@ export function Dialog({ title, open = false, onClose, children, actions = [], d
|
|
|
616
621
|
if (!el || el._dsTrap) return;
|
|
617
622
|
el._dsTrap = true;
|
|
618
623
|
el.addEventListener('keydown', (e) => trapTabKey(el, e));
|
|
619
|
-
|
|
624
|
+
// setTimeout(0), not queueMicrotask: the triggering click's own default
|
|
625
|
+
// focus-on-click can win a same-tick microtask race and leave focus on
|
|
626
|
+
// the trigger button instead of the dialog, breaking Escape/Tab-trap
|
|
627
|
+
// for keyboard users (keydown only bubbles from the focused element).
|
|
628
|
+
setTimeout(() => {
|
|
620
629
|
const f = el.querySelector(FOCUSABLE_SEL);
|
|
621
630
|
(f || el).focus();
|
|
622
|
-
});
|
|
631
|
+
}, 0);
|
|
623
632
|
},
|
|
624
633
|
},
|
|
625
634
|
title != null ? h('div', { class: 'ds-ep-dialog-head' }, h('h2', { class: 'ds-ep-dialog-title' }, title)) : null,
|
|
@@ -180,7 +180,10 @@ export function Popover({ open, anchorEl, onClose, placement = 'bottom-start', c
|
|
|
180
180
|
};
|
|
181
181
|
el.addEventListener('keydown', onKey);
|
|
182
182
|
document.addEventListener('mousedown', onDown, true);
|
|
183
|
-
|
|
183
|
+
// setTimeout(0), not queueMicrotask — see _anchoredOverlayLifecycle's
|
|
184
|
+
// comment: the opening click's own default focus-on-click can otherwise
|
|
185
|
+
// win the race and leave focus outside el, breaking Escape/Tab-trap.
|
|
186
|
+
setTimeout(() => { const f = el.querySelector(FOCUSABLE_SEL); (f || el).focus(); }, 0);
|
|
184
187
|
_popovers.set(anchorEl, { dispose() {
|
|
185
188
|
document.removeEventListener('mousedown', onDown, true);
|
|
186
189
|
floating.dispose();
|
|
@@ -399,7 +402,14 @@ function _anchoredOverlayLifecycle(el, { anchorX, anchorY, fallbackW, fallbackH,
|
|
|
399
402
|
const { left, top } = _clampToViewport(anchorX, anchorY, r.width || fallbackW, r.height || fallbackH);
|
|
400
403
|
el.style.left = left + 'px'; el.style.top = top + 'px';
|
|
401
404
|
};
|
|
402
|
-
|
|
405
|
+
// setTimeout(0), not queueMicrotask: the triggering click's own default
|
|
406
|
+
// focus-on-click (moving focus to the clicked <button>) can run AFTER a
|
|
407
|
+
// same-tick microtask, so a queueMicrotask focus() call here was losing
|
|
408
|
+
// the race and leaving focus on the trigger button instead of the
|
|
409
|
+
// dialog -- breaking Escape-to-close (keydown only bubbles from the
|
|
410
|
+
// focused element) for any keyboard user. A macrotask reliably runs
|
|
411
|
+
// after the click's focus settles.
|
|
412
|
+
setTimeout(() => { place(); el.focus(); }, 0);
|
|
403
413
|
const onDown = (e) => { if (!el.contains(e.target)) close(); };
|
|
404
414
|
queueMicrotask(() => document.addEventListener('mousedown', onDown, true));
|
|
405
415
|
return () => document.removeEventListener('mousedown', onDown, true);
|
|
@@ -837,7 +847,7 @@ export function VideoLightbox({ src, label = '', open = false, onClose } = {}) {
|
|
|
837
847
|
class: 'ov-lightbox-backdrop', role: 'dialog', 'aria-modal': 'true', 'aria-label': label || 'Video',
|
|
838
848
|
tabindex: '-1',
|
|
839
849
|
onkeydown: (e) => { if (e.key === 'Escape') { e.preventDefault(); close(); } },
|
|
840
|
-
ref: (el) => { if (el && !el._ovLb) { el._ovLb = true;
|
|
850
|
+
ref: (el) => { if (el && !el._ovLb) { el._ovLb = true; setTimeout(() => el.focus(), 0); } },
|
|
841
851
|
onmousedown: (e) => { if (e.target === e.currentTarget) close(); },
|
|
842
852
|
},
|
|
843
853
|
h('button', { type: 'button', class: 'ov-lightbox-x', 'aria-label': 'close', onclick: close }, Icon('x')),
|