@italia/globals 1.0.0-alpha.8 → 1.0.0-beta.0
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/custom-elements.json +341 -19
- package/dist/src/base-component/base-component.d.ts +2 -0
- package/dist/src/base-component/base-component.d.ts.map +1 -1
- package/dist/src/base-component/base-component.js +20 -0
- package/dist/src/base-component/base-component.js.map +1 -1
- package/dist/src/controllers/focus-trap-controller.d.ts +42 -22
- package/dist/src/controllers/focus-trap-controller.d.ts.map +1 -1
- package/dist/src/controllers/focus-trap-controller.js +350 -123
- package/dist/src/controllers/focus-trap-controller.js.map +1 -1
- package/dist/src/controllers/roving-tabindex-controller.d.ts +9 -2
- package/dist/src/controllers/roving-tabindex-controller.d.ts.map +1 -1
- package/dist/src/controllers/roving-tabindex-controller.js +11 -5
- package/dist/src/controllers/roving-tabindex-controller.js.map +1 -1
- package/dist/src/directives/setAttributes.d.ts.map +1 -1
- package/dist/src/directives/setAttributes.js +69 -3
- package/dist/src/directives/setAttributes.js.map +1 -1
- package/dist/src/form/form-control.js +1 -1
- package/dist/src/form/form-control.js.map +1 -1
- package/dist/src/form/form-controller.d.ts.map +1 -1
- package/dist/src/form/form-controller.js +8 -0
- package/dist/src/form/form-controller.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils/dispatch-cancelable.d.ts +31 -0
- package/dist/src/utils/dispatch-cancelable.d.ts.map +1 -0
- package/dist/src/utils/dispatch-cancelable.js +43 -0
- package/dist/src/utils/dispatch-cancelable.js.map +1 -0
- package/dist/src/utils/focus-fallback.d.ts +27 -0
- package/dist/src/utils/focus-fallback.d.ts.map +1 -0
- package/dist/src/utils/focus-fallback.js +63 -0
- package/dist/src/utils/focus-fallback.js.map +1 -0
- package/package.json +4 -4
package/custom-elements.json
CHANGED
|
@@ -167,6 +167,30 @@
|
|
|
167
167
|
"module": "./utils/cookies.js"
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
|
+
{
|
|
171
|
+
"kind": "js",
|
|
172
|
+
"name": "dispatchCancelable",
|
|
173
|
+
"declaration": {
|
|
174
|
+
"name": "dispatchCancelable",
|
|
175
|
+
"module": "./utils/dispatch-cancelable.js"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"kind": "js",
|
|
180
|
+
"name": "focusableFallbackAncestor",
|
|
181
|
+
"declaration": {
|
|
182
|
+
"name": "focusableFallbackAncestor",
|
|
183
|
+
"module": "./utils/focus-fallback.js"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"kind": "js",
|
|
188
|
+
"name": "nearestFocusableInDocument",
|
|
189
|
+
"declaration": {
|
|
190
|
+
"name": "nearestFocusableInDocument",
|
|
191
|
+
"module": "./utils/focus-fallback.js"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
170
194
|
{
|
|
171
195
|
"kind": "js",
|
|
172
196
|
"name": "WindowManager",
|
|
@@ -423,6 +447,14 @@
|
|
|
423
447
|
},
|
|
424
448
|
"privacy": "protected"
|
|
425
449
|
},
|
|
450
|
+
{
|
|
451
|
+
"kind": "field",
|
|
452
|
+
"name": "ariaAttributesObserver",
|
|
453
|
+
"type": {
|
|
454
|
+
"text": "MutationObserver | undefined"
|
|
455
|
+
},
|
|
456
|
+
"privacy": "protected"
|
|
457
|
+
},
|
|
426
458
|
{
|
|
427
459
|
"kind": "field",
|
|
428
460
|
"name": "_ariaAttributes",
|
|
@@ -810,7 +842,7 @@
|
|
|
810
842
|
"declarations": [
|
|
811
843
|
{
|
|
812
844
|
"kind": "class",
|
|
813
|
-
"description": "
|
|
845
|
+
"description": "Safari/VoiceOver iOS workarounds catalogue — why timers exist here:\n\n1. `activate()` rAF + setTimeout(50): Safari does not reliably update the VoiceOver\n accessibility tree synchronously. rAF ensures the element is painted before we\n attempt to focus it. setTimeout(50) yields 50ms so VoiceOver can settle its\n accessibility tree before announcing the newly focused element.\n Empirically, VoiceOver iOS needs 100–300ms; the animated path in it-modal already\n provides ~316ms naturally via animation.finished, so the 50ms here only truly\n matters for the no-animation / prefers-reduced-motion path.\n\n2. `_restoreFocus()` setTimeout(0): Same settle reason on close. The caller\n (it-modal finishHide) adds a belt-and-suspenders 20ms setTimeout; _restoreFocus\n is skipped via { skipFocusRestore: true } in that case to avoid double-focus.\n\n3. `activate()` iOS body-focus fallback: On iOS Safari, tapping a button does not\n reliably move document.activeElement away from body. We fall back to getTrigger()\n so _previousActiveElement is always a real DOM element to restore focus to on close.\n\nThere is no WebKit/Safari API to detect when VoiceOver has settled its accessibility\ntree. setTimeout-based workarounds are the same pattern used by Bootstrap 5, the\nfocus-trap npm package, and a11y-dialog.",
|
|
814
846
|
"name": "FocusTrapController",
|
|
815
847
|
"members": [
|
|
816
848
|
{
|
|
@@ -862,7 +894,7 @@
|
|
|
862
894
|
"kind": "field",
|
|
863
895
|
"name": "_focusableElements",
|
|
864
896
|
"type": {
|
|
865
|
-
"text": "
|
|
897
|
+
"text": "HTMLElement[]"
|
|
866
898
|
},
|
|
867
899
|
"privacy": "private",
|
|
868
900
|
"default": "[]"
|
|
@@ -871,7 +903,7 @@
|
|
|
871
903
|
"kind": "field",
|
|
872
904
|
"name": "_first",
|
|
873
905
|
"type": {
|
|
874
|
-
"text": "
|
|
906
|
+
"text": "HTMLElement | undefined"
|
|
875
907
|
},
|
|
876
908
|
"privacy": "private"
|
|
877
909
|
},
|
|
@@ -879,10 +911,30 @@
|
|
|
879
911
|
"kind": "field",
|
|
880
912
|
"name": "_last",
|
|
881
913
|
"type": {
|
|
882
|
-
"text": "
|
|
914
|
+
"text": "HTMLElement | undefined"
|
|
883
915
|
},
|
|
884
916
|
"privacy": "private"
|
|
885
917
|
},
|
|
918
|
+
{
|
|
919
|
+
"kind": "field",
|
|
920
|
+
"name": "_lastKnownFocusIndex",
|
|
921
|
+
"type": {
|
|
922
|
+
"text": "number"
|
|
923
|
+
},
|
|
924
|
+
"privacy": "private",
|
|
925
|
+
"default": "-1",
|
|
926
|
+
"description": "Last known index resolved from real focusin events inside the trap.\nUsed as a fallback when assistive tech retargeting makes activeElement\ntemporarily unmappable during Tab navigation."
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
"kind": "field",
|
|
930
|
+
"name": "_pendingFocusTimer",
|
|
931
|
+
"type": {
|
|
932
|
+
"text": "ReturnType<typeof setTimeout> | null"
|
|
933
|
+
},
|
|
934
|
+
"privacy": "private",
|
|
935
|
+
"default": "null",
|
|
936
|
+
"description": "Timer ID for the focus call scheduled inside activate(). Cancelled by deactivate()\nto prevent focus firing after the trap has been torn down (fast open/close, unmount)."
|
|
937
|
+
},
|
|
886
938
|
{
|
|
887
939
|
"kind": "field",
|
|
888
940
|
"name": "FOCUSABLE_SELECTORS",
|
|
@@ -890,6 +942,159 @@
|
|
|
890
942
|
"static": true,
|
|
891
943
|
"readonly": true
|
|
892
944
|
},
|
|
945
|
+
{
|
|
946
|
+
"kind": "field",
|
|
947
|
+
"name": "NATIVE_FOCUSABLE_SELECTORS",
|
|
948
|
+
"privacy": "private",
|
|
949
|
+
"static": true,
|
|
950
|
+
"readonly": true
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
"kind": "field",
|
|
954
|
+
"name": "MANAGED_HOST_SELECTORS",
|
|
955
|
+
"privacy": "private",
|
|
956
|
+
"static": true,
|
|
957
|
+
"readonly": true
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
"kind": "field",
|
|
961
|
+
"name": "MANAGED_MENU_HOST_SELECTORS",
|
|
962
|
+
"privacy": "private",
|
|
963
|
+
"static": true,
|
|
964
|
+
"readonly": true
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
"kind": "method",
|
|
968
|
+
"name": "getManagedHostAncestor",
|
|
969
|
+
"privacy": "private",
|
|
970
|
+
"static": true,
|
|
971
|
+
"return": {
|
|
972
|
+
"type": {
|
|
973
|
+
"text": "HTMLElement | null"
|
|
974
|
+
}
|
|
975
|
+
},
|
|
976
|
+
"parameters": [
|
|
977
|
+
{
|
|
978
|
+
"name": "element",
|
|
979
|
+
"type": {
|
|
980
|
+
"text": "HTMLElement"
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
]
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"kind": "method",
|
|
987
|
+
"name": "isInsideManagedHost",
|
|
988
|
+
"privacy": "private",
|
|
989
|
+
"static": true,
|
|
990
|
+
"return": {
|
|
991
|
+
"type": {
|
|
992
|
+
"text": "boolean"
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
"parameters": [
|
|
996
|
+
{
|
|
997
|
+
"name": "element",
|
|
998
|
+
"type": {
|
|
999
|
+
"text": "HTMLElement"
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
]
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
"kind": "method",
|
|
1006
|
+
"name": "getManagedMenuHostAncestor",
|
|
1007
|
+
"privacy": "private",
|
|
1008
|
+
"static": true,
|
|
1009
|
+
"return": {
|
|
1010
|
+
"type": {
|
|
1011
|
+
"text": "HTMLElement | null"
|
|
1012
|
+
}
|
|
1013
|
+
},
|
|
1014
|
+
"parameters": [
|
|
1015
|
+
{
|
|
1016
|
+
"name": "element",
|
|
1017
|
+
"type": {
|
|
1018
|
+
"text": "HTMLElement"
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
]
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
"kind": "method",
|
|
1025
|
+
"name": "collectFocusableCandidates",
|
|
1026
|
+
"privacy": "private",
|
|
1027
|
+
"static": true,
|
|
1028
|
+
"return": {
|
|
1029
|
+
"type": {
|
|
1030
|
+
"text": "void"
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
"parameters": [
|
|
1034
|
+
{
|
|
1035
|
+
"name": "root",
|
|
1036
|
+
"type": {
|
|
1037
|
+
"text": "ParentNode"
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
"name": "candidates",
|
|
1042
|
+
"type": {
|
|
1043
|
+
"text": "HTMLElement[]"
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
"name": "trigger",
|
|
1048
|
+
"type": {
|
|
1049
|
+
"text": "HTMLElement | ShadowRoot | null"
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"name": "visited",
|
|
1054
|
+
"type": {
|
|
1055
|
+
"text": "Set<Node>"
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
]
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
"kind": "method",
|
|
1062
|
+
"name": "getFirstFocusableInShadow",
|
|
1063
|
+
"privacy": "private",
|
|
1064
|
+
"static": true,
|
|
1065
|
+
"return": {
|
|
1066
|
+
"type": {
|
|
1067
|
+
"text": "HTMLElement | null"
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
1070
|
+
"parameters": [
|
|
1071
|
+
{
|
|
1072
|
+
"name": "host",
|
|
1073
|
+
"type": {
|
|
1074
|
+
"text": "HTMLElement"
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
]
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
"kind": "method",
|
|
1081
|
+
"name": "focusCandidate",
|
|
1082
|
+
"privacy": "private",
|
|
1083
|
+
"static": true,
|
|
1084
|
+
"return": {
|
|
1085
|
+
"type": {
|
|
1086
|
+
"text": "void"
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
"parameters": [
|
|
1090
|
+
{
|
|
1091
|
+
"name": "target",
|
|
1092
|
+
"type": {
|
|
1093
|
+
"text": "HTMLElement | undefined"
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
]
|
|
1097
|
+
},
|
|
893
1098
|
{
|
|
894
1099
|
"kind": "method",
|
|
895
1100
|
"name": "isFocusable",
|
|
@@ -924,7 +1129,6 @@
|
|
|
924
1129
|
"type": {
|
|
925
1130
|
"text": "boolean"
|
|
926
1131
|
},
|
|
927
|
-
"description": "Indica se il focus trap è attivo",
|
|
928
1132
|
"readonly": true
|
|
929
1133
|
},
|
|
930
1134
|
{
|
|
@@ -934,8 +1138,7 @@
|
|
|
934
1138
|
"type": {
|
|
935
1139
|
"text": "void"
|
|
936
1140
|
}
|
|
937
|
-
}
|
|
938
|
-
"description": "Attiva il focus trap.\nSalva l'elemento attivo corrente e attiva i listener.\nNOTA: chiamare updateFocusableElements() e focusFirst() separatamente quando necessario."
|
|
1141
|
+
}
|
|
939
1142
|
},
|
|
940
1143
|
{
|
|
941
1144
|
"kind": "method",
|
|
@@ -945,7 +1148,15 @@
|
|
|
945
1148
|
"text": "void"
|
|
946
1149
|
}
|
|
947
1150
|
},
|
|
948
|
-
"
|
|
1151
|
+
"parameters": [
|
|
1152
|
+
{
|
|
1153
|
+
"name": "options",
|
|
1154
|
+
"optional": true,
|
|
1155
|
+
"type": {
|
|
1156
|
+
"text": "{ skipFocusRestore?: boolean }"
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
]
|
|
949
1160
|
},
|
|
950
1161
|
{
|
|
951
1162
|
"kind": "method",
|
|
@@ -989,18 +1200,13 @@
|
|
|
989
1200
|
"description": "Ritorna l'elemento attivo corrente, attraversando shadow DOM e slot"
|
|
990
1201
|
},
|
|
991
1202
|
{
|
|
992
|
-
"kind": "
|
|
993
|
-
"name": "
|
|
994
|
-
"
|
|
995
|
-
"type": {
|
|
996
|
-
"text": "void"
|
|
997
|
-
}
|
|
998
|
-
},
|
|
999
|
-
"description": "Metti a fuoco l'elemento iniziale specificato nella config, se presente.\nSe non è fornito, fallback sul primo elemento tabbabile."
|
|
1203
|
+
"kind": "field",
|
|
1204
|
+
"name": "_handleKeyDown",
|
|
1205
|
+
"privacy": "private"
|
|
1000
1206
|
},
|
|
1001
1207
|
{
|
|
1002
1208
|
"kind": "field",
|
|
1003
|
-
"name": "
|
|
1209
|
+
"name": "_handleFocusIn",
|
|
1004
1210
|
"privacy": "private"
|
|
1005
1211
|
},
|
|
1006
1212
|
{
|
|
@@ -1067,10 +1273,10 @@
|
|
|
1067
1273
|
"kind": "field",
|
|
1068
1274
|
"name": "config",
|
|
1069
1275
|
"type": {
|
|
1070
|
-
"text": "RovingTabindexConfig<T> & {\n wrap: boolean;\n direction: 'horizontal' | 'vertical' | 'both';\n selectOnFocus: boolean;\n skipItem: (item: T) => boolean;\n }"
|
|
1276
|
+
"text": "RovingTabindexConfig<T> & {\n wrap: boolean;\n direction: 'horizontal' | 'vertical' | 'both' | (() => 'horizontal' | 'vertical' | 'both');\n selectOnFocus: boolean;\n selectOnHomeEnd: boolean;\n skipItem: (item: T) => boolean;\n }"
|
|
1071
1277
|
},
|
|
1072
1278
|
"privacy": "private",
|
|
1073
|
-
"default": "{ wrap: true, direction: 'both', selectOnFocus: false, skipItem: (item) => item.hasAttribute('disabled') || (item as any).disabled === true, ...config, }"
|
|
1279
|
+
"default": "{ wrap: true, direction: 'both', selectOnFocus: false, selectOnHomeEnd: false, skipItem: (item) => item.hasAttribute('disabled') || (item as any).disabled === true, ...config, }"
|
|
1074
1280
|
},
|
|
1075
1281
|
{
|
|
1076
1282
|
"kind": "method",
|
|
@@ -2262,6 +2468,122 @@
|
|
|
2262
2468
|
}
|
|
2263
2469
|
]
|
|
2264
2470
|
},
|
|
2471
|
+
{
|
|
2472
|
+
"kind": "javascript-module",
|
|
2473
|
+
"path": "src/utils/dispatch-cancelable.ts",
|
|
2474
|
+
"declarations": [
|
|
2475
|
+
{
|
|
2476
|
+
"kind": "function",
|
|
2477
|
+
"name": "dispatchCancelable",
|
|
2478
|
+
"return": {
|
|
2479
|
+
"type": {
|
|
2480
|
+
"text": ""
|
|
2481
|
+
}
|
|
2482
|
+
},
|
|
2483
|
+
"parameters": [
|
|
2484
|
+
{
|
|
2485
|
+
"name": "host",
|
|
2486
|
+
"type": {
|
|
2487
|
+
"text": "HTMLElement"
|
|
2488
|
+
},
|
|
2489
|
+
"description": "the element dispatching the event"
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
"name": "name",
|
|
2493
|
+
"type": {
|
|
2494
|
+
"text": "string"
|
|
2495
|
+
},
|
|
2496
|
+
"description": "the event name (kebab-case, `it-` prefixed)"
|
|
2497
|
+
},
|
|
2498
|
+
{
|
|
2499
|
+
"name": "detail",
|
|
2500
|
+
"type": {
|
|
2501
|
+
"text": "T"
|
|
2502
|
+
},
|
|
2503
|
+
"description": "the event `detail` payload"
|
|
2504
|
+
},
|
|
2505
|
+
{
|
|
2506
|
+
"name": "defaultAction",
|
|
2507
|
+
"type": {
|
|
2508
|
+
"text": "() => void"
|
|
2509
|
+
},
|
|
2510
|
+
"description": "the behavior executed when the event is not prevented"
|
|
2511
|
+
}
|
|
2512
|
+
],
|
|
2513
|
+
"description": "Dispatches a cancelable custom event and runs the provided default action\nonly if the consumer did not call `event.preventDefault()`.\n\nThis is the shared convention used across components (Tabs, Modal, Chip, Alert,\nForward, Back) to provide a sensible default JavaScript behavior out of the box\nwhile letting consumers intercept and override it. Notification deliberately does\nNOT use this: its show/close are always caller-initiated (no default markup-driven\ntrigger to override), so there was no real use case for blocking them — see\nit-notification.ts for the plain (non-cancelable) events it fires instead.\n\n```js\nel.addEventListener('it-alert-close', (e) => {\n e.preventDefault(); // block the default removal\n fetchConfirmation().then((ok) => { // async logic runs after prevention\n if (ok) e.target.close();\n });\n});\n```\n\nNote: `preventDefault()` must be called synchronously inside the listener.\nAsync code can run afterward; call the component's public method when ready."
|
|
2514
|
+
}
|
|
2515
|
+
],
|
|
2516
|
+
"exports": [
|
|
2517
|
+
{
|
|
2518
|
+
"kind": "js",
|
|
2519
|
+
"name": "dispatchCancelable",
|
|
2520
|
+
"declaration": {
|
|
2521
|
+
"name": "dispatchCancelable",
|
|
2522
|
+
"module": "src/utils/dispatch-cancelable.ts"
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
]
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
"kind": "javascript-module",
|
|
2529
|
+
"path": "src/utils/focus-fallback.ts",
|
|
2530
|
+
"declarations": [
|
|
2531
|
+
{
|
|
2532
|
+
"kind": "function",
|
|
2533
|
+
"name": "focusableFallbackAncestor",
|
|
2534
|
+
"return": {
|
|
2535
|
+
"type": {
|
|
2536
|
+
"text": "HTMLElement | null"
|
|
2537
|
+
}
|
|
2538
|
+
},
|
|
2539
|
+
"parameters": [
|
|
2540
|
+
{
|
|
2541
|
+
"name": "el",
|
|
2542
|
+
"type": {
|
|
2543
|
+
"text": "HTMLElement"
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
],
|
|
2547
|
+
"description": "Returns the nearest focusable ancestor of `el` by walking up parentElement.\nUsed as the last-resort fallback when a self-removing component (chip, alert)\nhas no adjacent sibling of the same type to shift focus to.\n\n\"Focusable ancestor\" means an element with tabindex >= 0. The container that\nwraps a chip group or alert list is the expected target; authors following the\nWAI-ARIA pattern should give it tabindex=\"0\"."
|
|
2548
|
+
},
|
|
2549
|
+
{
|
|
2550
|
+
"kind": "function",
|
|
2551
|
+
"name": "nearestFocusableInDocument",
|
|
2552
|
+
"return": {
|
|
2553
|
+
"type": {
|
|
2554
|
+
"text": "HTMLElement | null"
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
"parameters": [
|
|
2558
|
+
{
|
|
2559
|
+
"name": "el",
|
|
2560
|
+
"type": {
|
|
2561
|
+
"text": "HTMLElement"
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
],
|
|
2565
|
+
"description": "True last-resort fallback for when a self-removing component (alert, chip,\nnotification) has neither an adjacent sibling of the same type nor a\n`focusableFallbackAncestor` (i.e. no author-provided `tabindex=\"0\"` wrapper) —\nthe common case in practice, since most real usages don't add that wrapper.\nWithout this, focus silently drops to `<body>` with no way for a keyboard/AT\nuser to tell where they ended up.\n\nFinds the closest focusable element to `el` anywhere in the document, walking\noutward in document order: the nearest one that comes before `el` (closer to\nwhere the user's attention already was), falling back to the nearest one after.\nThis is a coarse, page-wide search — it may land focus on something not\nvisually adjacent — but it is deterministic and strictly better than silently\nlosing focus."
|
|
2566
|
+
}
|
|
2567
|
+
],
|
|
2568
|
+
"exports": [
|
|
2569
|
+
{
|
|
2570
|
+
"kind": "js",
|
|
2571
|
+
"name": "focusableFallbackAncestor",
|
|
2572
|
+
"declaration": {
|
|
2573
|
+
"name": "focusableFallbackAncestor",
|
|
2574
|
+
"module": "src/utils/focus-fallback.ts"
|
|
2575
|
+
}
|
|
2576
|
+
},
|
|
2577
|
+
{
|
|
2578
|
+
"kind": "js",
|
|
2579
|
+
"name": "nearestFocusableInDocument",
|
|
2580
|
+
"declaration": {
|
|
2581
|
+
"name": "nearestFocusableInDocument",
|
|
2582
|
+
"module": "src/utils/focus-fallback.ts"
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
]
|
|
2586
|
+
},
|
|
2265
2587
|
{
|
|
2266
2588
|
"kind": "javascript-module",
|
|
2267
2589
|
"path": "src/utils/logger.ts",
|
|
@@ -15,6 +15,7 @@ export declare class BaseComponent extends LitElement {
|
|
|
15
15
|
protected logger: Logger;
|
|
16
16
|
protected composeClass: typeof clsx;
|
|
17
17
|
protected _id?: string;
|
|
18
|
+
protected ariaAttributesObserver?: MutationObserver;
|
|
18
19
|
constructor();
|
|
19
20
|
protected get _ariaAttributes(): Record<string, string>;
|
|
20
21
|
generateId(prefix: string): string;
|
|
@@ -23,6 +24,7 @@ export declare class BaseComponent extends LitElement {
|
|
|
23
24
|
get focusElement(): HTMLElement | null;
|
|
24
25
|
protected get prefersReducedMotion(): boolean;
|
|
25
26
|
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
26
28
|
}
|
|
27
29
|
export declare const BaseLocalizedComponent: (new (...args: any[]) => {
|
|
28
30
|
localize: import("@italia/i18n").LocalizeController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-component.d.ts","sourceRoot":"","sources":["../../../src/base-component/base-component.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,YAAY,EAAE,OAAO,IAAI,CAAC;CAC3B;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,UAAU,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAExF;;;GAGG;AAEH,qBAAa,aAAc,SAAQ,UAAU;IAC3C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,YAAY,cAAQ;IAE9B,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;;
|
|
1
|
+
{"version":3,"file":"base-component.d.ts","sourceRoot":"","sources":["../../../src/base-component/base-component.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,YAAY,EAAE,OAAO,IAAI,CAAC;CAC3B;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,UAAU,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAExF;;;GAGG;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiiO,CAAC;cAA6F,CAAC;eAA8F,CAAC;gBAA+F,CAAC;;;;;;;;;;;;;;SAAulC,CAAC;;;iBAA+E,CAAC;yBADjyrB,CAAC"}
|
|
@@ -52,6 +52,26 @@ export class BaseComponent extends LitElement {
|
|
|
52
52
|
// generate internal _id
|
|
53
53
|
const prefix = this.id?.length > 0 ? this.id : this.tagName.toLowerCase();
|
|
54
54
|
this._id = this.generateId(prefix);
|
|
55
|
+
this.ariaAttributesObserver = new MutationObserver((mutations) => {
|
|
56
|
+
const shouldUpdate = mutations.some((mutation) => {
|
|
57
|
+
if (mutation.type !== 'attributes' || !mutation.attributeName) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return mutation.attributeName === 'it-role' || mutation.attributeName.startsWith('it-aria-');
|
|
61
|
+
});
|
|
62
|
+
if (shouldUpdate) {
|
|
63
|
+
this.requestUpdate();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.ariaAttributesObserver.observe(this, {
|
|
67
|
+
attributes: true,
|
|
68
|
+
attributeOldValue: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
this.ariaAttributesObserver?.disconnect();
|
|
73
|
+
this.ariaAttributesObserver = undefined;
|
|
74
|
+
super.disconnectedCallback();
|
|
55
75
|
}
|
|
56
76
|
}
|
|
57
77
|
export const BaseLocalizedComponent = LocalizeMixin(BaseComponent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-component.js","sourceRoot":"","sources":["../../../src/base-component/base-component.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,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AC,CAAC;YAEH,IAAI,YAAY,EAAE,CAAC;gBACjB,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE;YACxC,UAAU,EAAE,IAAI;YAChB,iBAAiB,EAAE,IAAI;SACxB,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,sBAAsB,EAAE,UAAU,EAAE,CAAC;QAC1C,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC;QACxC,KAAK,CAAC,oBAAoB,EAAE,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import clsx from 'clsx';\nimport { LitElement } from 'lit';\nimport { LocalizeMixin } from '@italia/i18n';\nimport { Constructor } from '../index.js';\nimport { Logger } from '../utils/logger.js';\n\n// import TrackFocus from '../utils/track-focus.js';\n\nexport interface BaseComponentInterface {\n addFocus(element: HTMLElement): void;\n composeClass: typeof clsx;\n}\n\nexport type BaseComponentType = typeof LitElement & Constructor<BaseComponentInterface>;\n\n/**\n * Factory function per creare una base class estendibile\n * con stili personalizzati.\n */\n\nexport class BaseComponent extends LitElement {\n protected logger: Logger;\n\n protected composeClass = clsx;\n\n protected _id?: string; // id interno del componente, da usare sui veri elementi HTML\n\n protected ariaAttributesObserver?: MutationObserver;\n\n constructor() {\n super();\n this.logger = new Logger(this.tagName.toLowerCase());\n }\n\n protected get _ariaAttributes(): Record<string, string> {\n const attributes: Record<string, string> = {};\n for (const attr of this.getAttributeNames()) {\n if (attr === 'it-role') {\n attributes.role = this.getAttribute(attr)!;\n } else if (attr.startsWith('it-aria-')) {\n attributes[attr.replace(/^it-/, '')] = this.getAttribute(attr)!;\n }\n }\n return attributes;\n }\n\n // eslint-disable-next-line class-methods-use-this\n generateId(prefix: string) {\n return `${prefix}-${Math.random().toString(36).slice(2)}`;\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n addFocus(element: HTMLElement) {\n // new TrackFocus(element); // per il momento è stato disattivato perchè ci sono le pseudo classi ::focus-visible per fare quello che fa TrackFocus. Si possono aggiungere regole css in bsi-italia 3 dato che stiamo facendo una breaking release di bsi.\n }\n\n // eslint-disable-next-line class-methods-use-this\n protected getActiveElement<T extends HTMLElement>(): T | null {\n let active = document.activeElement;\n while (active && active.shadowRoot && active.shadowRoot.activeElement) {\n active = active.shadowRoot.activeElement;\n }\n return active as T | null;\n }\n\n get focusElement(): HTMLElement | null {\n return this;\n }\n\n // eslint-disable-next-line class-methods-use-this\n protected get prefersReducedMotion(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n connectedCallback() {\n super.connectedCallback();\n\n // generate internal _id\n const prefix = this.id?.length > 0 ? this.id : this.tagName.toLowerCase();\n this._id = this.generateId(prefix);\n\n this.ariaAttributesObserver = new MutationObserver((mutations) => {\n const shouldUpdate = mutations.some((mutation) => {\n if (mutation.type !== 'attributes' || !mutation.attributeName) {\n return false;\n }\n\n return mutation.attributeName === 'it-role' || mutation.attributeName.startsWith('it-aria-');\n });\n\n if (shouldUpdate) {\n this.requestUpdate();\n }\n });\n\n this.ariaAttributesObserver.observe(this, {\n attributes: true,\n attributeOldValue: true,\n });\n }\n\n disconnectedCallback() {\n this.ariaAttributesObserver?.disconnect();\n this.ariaAttributesObserver = undefined;\n super.disconnectedCallback();\n }\n}\n\nexport const BaseLocalizedComponent = LocalizeMixin(BaseComponent);\n"]}
|
|
@@ -12,11 +12,27 @@ export interface FocusTrapConfig {
|
|
|
12
12
|
disableEscape?: boolean;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* Implementa le linee guida WAI-ARIA per i dialog modali.
|
|
15
|
+
* Safari/VoiceOver iOS workarounds catalogue — why timers exist here:
|
|
17
16
|
*
|
|
18
|
-
|
|
19
|
-
*
|
|
17
|
+
* 1. `activate()` rAF + setTimeout(50): Safari does not reliably update the VoiceOver
|
|
18
|
+
* accessibility tree synchronously. rAF ensures the element is painted before we
|
|
19
|
+
* attempt to focus it. setTimeout(50) yields 50ms so VoiceOver can settle its
|
|
20
|
+
* accessibility tree before announcing the newly focused element.
|
|
21
|
+
* Empirically, VoiceOver iOS needs 100–300ms; the animated path in it-modal already
|
|
22
|
+
* provides ~316ms naturally via animation.finished, so the 50ms here only truly
|
|
23
|
+
* matters for the no-animation / prefers-reduced-motion path.
|
|
24
|
+
*
|
|
25
|
+
* 2. `_restoreFocus()` setTimeout(0): Same settle reason on close. The caller
|
|
26
|
+
* (it-modal finishHide) adds a belt-and-suspenders 20ms setTimeout; _restoreFocus
|
|
27
|
+
* is skipped via { skipFocusRestore: true } in that case to avoid double-focus.
|
|
28
|
+
*
|
|
29
|
+
* 3. `activate()` iOS body-focus fallback: On iOS Safari, tapping a button does not
|
|
30
|
+
* reliably move document.activeElement away from body. We fall back to getTrigger()
|
|
31
|
+
* so _previousActiveElement is always a real DOM element to restore focus to on close.
|
|
32
|
+
*
|
|
33
|
+
* There is no WebKit/Safari API to detect when VoiceOver has settled its accessibility
|
|
34
|
+
* tree. setTimeout-based workarounds are the same pattern used by Bootstrap 5, the
|
|
35
|
+
* focus-trap npm package, and a11y-dialog.
|
|
20
36
|
*/
|
|
21
37
|
export declare class FocusTrapController implements ReactiveController {
|
|
22
38
|
private host;
|
|
@@ -25,9 +41,25 @@ export declare class FocusTrapController implements ReactiveController {
|
|
|
25
41
|
private _isActive;
|
|
26
42
|
private _previousActiveElement;
|
|
27
43
|
private _focusableElements;
|
|
28
|
-
private _first
|
|
29
|
-
private _last
|
|
44
|
+
private _first?;
|
|
45
|
+
private _last?;
|
|
46
|
+
/** Last known index resolved from real focusin events inside the trap.
|
|
47
|
+
* Used as a fallback when assistive tech retargeting makes activeElement
|
|
48
|
+
* temporarily unmappable during Tab navigation. */
|
|
49
|
+
private _lastKnownFocusIndex;
|
|
50
|
+
/** Timer ID for the focus call scheduled inside activate(). Cancelled by deactivate()
|
|
51
|
+
* to prevent focus firing after the trap has been torn down (fast open/close, unmount). */
|
|
52
|
+
private _pendingFocusTimer;
|
|
30
53
|
private static readonly FOCUSABLE_SELECTORS;
|
|
54
|
+
private static readonly NATIVE_FOCUSABLE_SELECTORS;
|
|
55
|
+
private static readonly MANAGED_HOST_SELECTORS;
|
|
56
|
+
private static readonly MANAGED_MENU_HOST_SELECTORS;
|
|
57
|
+
private static getManagedHostAncestor;
|
|
58
|
+
private static isInsideManagedHost;
|
|
59
|
+
private static getManagedMenuHostAncestor;
|
|
60
|
+
private static collectFocusableCandidates;
|
|
61
|
+
private static getFirstFocusableInShadow;
|
|
62
|
+
private static focusCandidate;
|
|
31
63
|
/**
|
|
32
64
|
* Verifica se un elemento è effettivamente focusabile e tabbabile.
|
|
33
65
|
* Elementi con tabindex="-1" sono focusabili programmaticamente ma non tabbabili.
|
|
@@ -36,19 +68,11 @@ export declare class FocusTrapController implements ReactiveController {
|
|
|
36
68
|
constructor(host: ReactiveControllerHost & HTMLElement, config: FocusTrapConfig);
|
|
37
69
|
hostConnected(): void;
|
|
38
70
|
hostDisconnected(): void;
|
|
39
|
-
/** Indica se il focus trap è attivo */
|
|
40
71
|
get isActive(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Attiva il focus trap.
|
|
43
|
-
* Salva l'elemento attivo corrente e attiva i listener.
|
|
44
|
-
* NOTA: chiamare updateFocusableElements() e focusFirst() separatamente quando necessario.
|
|
45
|
-
*/
|
|
46
72
|
activate(): void;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
deactivate(): void;
|
|
73
|
+
deactivate(options?: {
|
|
74
|
+
skipFocusRestore?: boolean;
|
|
75
|
+
}): void;
|
|
52
76
|
/**
|
|
53
77
|
* Aggiorna la lista degli elementi focusabili.
|
|
54
78
|
* Chiamare dopo modifiche al DOM.
|
|
@@ -60,12 +84,8 @@ export declare class FocusTrapController implements ReactiveController {
|
|
|
60
84
|
focusLast(): void;
|
|
61
85
|
/** Ritorna l'elemento attivo corrente, attraversando shadow DOM e slot */
|
|
62
86
|
static getActiveElement(): HTMLElement | null;
|
|
63
|
-
/**
|
|
64
|
-
* Metti a fuoco l'elemento iniziale specificato nella config, se presente.
|
|
65
|
-
* Se non è fornito, fallback sul primo elemento tabbabile.
|
|
66
|
-
*/
|
|
67
|
-
focusInitial(): void;
|
|
68
87
|
private _handleKeyDown;
|
|
88
|
+
private _handleFocusIn;
|
|
69
89
|
private _handleTab;
|
|
70
90
|
private _restoreFocus;
|
|
71
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-trap-controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/focus-trap-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"focus-trap-controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/focus-trap-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,YAAY,EAAE,MAAM,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IACpD,4EAA4E;IAC5E,UAAU,EAAE,MAAM,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAClD,0GAA0G;IAC1G,YAAY,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACxC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,qCAAqC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,mBAAoB,YAAW,kBAAkB;IAC5D,OAAO,CAAC,IAAI,CAAuC;IAEnD,OAAO,CAAC,MAAM,CAAkB;IAEhC,OAAO,CAAC,QAAQ,CAAiC;IAEjD,OAAO,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