@remit/web-client 0.0.211 → 0.0.212

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.211",
3
+ "version": "0.0.212",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {
@@ -107,13 +107,22 @@ describe("Drawer keeps Tab inside itself", () => {
107
107
  assert.equal(document.activeElement, closeButton());
108
108
  });
109
109
 
110
- it("pulls focus back in when it is somewhere else entirely", () => {
110
+ it("leaves focus outside the drawer alone", () => {
111
111
  open(createElement(Fragment, null, button("alpha")));
112
112
  outside.focus();
113
113
 
114
114
  press("Tab");
115
115
 
116
- assert.equal(document.activeElement, closeButton());
116
+ assert.equal(document.activeElement, outside);
117
+ });
118
+
119
+ it("leaves focus outside the drawer alone on shift+Tab too", () => {
120
+ open(createElement(Fragment, null, button("alpha")));
121
+ outside.focus();
122
+
123
+ press("Tab", true);
124
+
125
+ assert.equal(document.activeElement, outside);
117
126
  });
118
127
 
119
128
  it("leaves an interior Tab to the browser", () => {
@@ -73,24 +73,25 @@ export const Drawer = ({
73
73
  onClose();
74
74
  return;
75
75
  }
76
- // Trap Tab inside the drawer: it is `aria-modal`, so a screen reader
77
- // offers nothing outside it — and letting Tab walk out would land on
78
- // controls a pointer cannot reach under the scrim (#747).
76
+ // Wrap Tab at the ends of the drawer's ring: walking off the last
77
+ // control cycles back to the first instead of landing on controls a
78
+ // pointer cannot reach under the scrim (#747). Focus that is already
79
+ // outside the drawer — an error banner, the fatal-error overlay — is
80
+ // left alone; the drawer does not pull it back in.
79
81
  if (event.key !== "Tab" || !drawerRef.current) return;
80
82
  const ring = tabRing(drawerRef.current);
81
83
  if (ring.length === 0) return;
82
84
  const first = ring[0];
83
85
  const last = ring[ring.length - 1];
84
86
  const active = document.activeElement;
85
- const inside = active instanceof HTMLElement && ring.includes(active);
86
87
  if (event.shiftKey) {
87
- if (!inside || active === first) {
88
+ if (active === first) {
88
89
  event.preventDefault();
89
90
  last.focus();
90
91
  }
91
92
  return;
92
93
  }
93
- if (!inside || active === last) {
94
+ if (active === last) {
94
95
  event.preventDefault();
95
96
  first.focus();
96
97
  }