@justai/core 0.4.0 → 0.4.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +6 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.4.0",
4
- "description": "The framework-free heart of the persona shell — the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
3
+ "version": "0.4.1",
4
+ "description": "The framework-free heart of the persona shell \u2014 the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
7
7
  "type": "git",
package/src/index.js CHANGED
@@ -277,12 +277,17 @@ export function consentCopy(lang) {
277
277
  * or a visitor is denied by region while never being offered the dialog.
278
278
  *
279
279
  * `returnValue` survives a close, so it is reset before every open or a stale answer replays.
280
+ *
281
+ * FOCUS IS GIVEN AT OPEN, not by an autofocus attribute. Chrome refuses to process `autofocus` in
282
+ * any document whose URL carries a fragment and warns on every load — /me#profile met it first. So
283
+ * the sheet ships no attribute, and the opener places focus by the genre's law: the ask genre puts
284
+ * it on the invitation (here), the destructive genre on the cancel (that consumer's own open).
280
285
  */
281
286
  export const CONSENT_JS = `(function(){try{
282
287
  var h=location.hostname;
283
288
  if(h==="localhost"||h==="127.0.0.1"||h==="::1"||h==="[::1]"||h.indexOf("dev-")===0)return;
284
289
  var el=document.getElementById("consent");if(!el||!el.showModal)return;
285
- var open=function(){if(!el.open){el.returnValue="";el.showModal()}};
290
+ var open=function(){if(!el.open){el.returnValue="";el.showModal();var p=el.querySelector(".preferred");if(p)p.focus()}};
286
291
  el.addEventListener("close",function(){
287
292
  var rv=el.returnValue;
288
293
  var v=rv==="confirm"?"granted":rv==="denied"?"denied":null;