@ultraviolet/ui 1.11.1 → 1.11.2

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.
@@ -81,7 +81,6 @@ const Dialog = _ref9 => {
81
81
  const element = containerRef.current;
82
82
  if (open) {
83
83
  document.body.appendChild(element);
84
- dialogRef.current?.focus();
85
84
  }
86
85
  return () => {
87
86
  if (document.body.contains(element)) {
@@ -105,6 +104,7 @@ const Dialog = _ref9 => {
105
104
  }
106
105
  };
107
106
  if (open) {
107
+ dialogRef.current?.focus();
108
108
  document.body.addEventListener('keyup', handleEscPress, {
109
109
  capture: true
110
110
  });
@@ -166,11 +166,11 @@ const Dialog = _ref9 => {
166
166
  const firstFocusableEl = focusableEls[0];
167
167
  const lastFocusableEl = focusableEls[focusableEls.length - 1];
168
168
  if (event.shiftKey) {
169
- if (document.activeElement === firstFocusableEl) {
169
+ if (document.activeElement === firstFocusableEl || document.activeElement === dialogRef.current) {
170
170
  lastFocusableEl.focus();
171
171
  event.preventDefault();
172
172
  }
173
- } else if (document.activeElement === lastFocusableEl) {
173
+ } else if (document.activeElement === lastFocusableEl || document.activeElement === dialogRef.current) {
174
174
  firstFocusableEl.focus();
175
175
  event.preventDefault();
176
176
  }
@@ -204,6 +204,7 @@ const Dialog = _ref9 => {
204
204
  onClose: stopCancel,
205
205
  "aria-modal": true,
206
206
  ref: dialogRef,
207
+ tabIndex: 0,
207
208
  children: open ? children : null
208
209
  })
209
210
  }), containerRef.current);
@@ -17,11 +17,6 @@ const Disclosure = _ref => {
17
17
  element?.removeEventListener('click', handleOpen);
18
18
  };
19
19
  }, [handleOpen, disclosureRef]);
20
- useEffect(() => {
21
- if (!visible) {
22
- disclosureRef.current?.focus();
23
- }
24
- }, [visible, disclosureRef]);
25
20
  if (typeof disclosure === 'function') {
26
21
  return disclosure({
27
22
  visible,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -43,9 +43,9 @@
43
43
  "@emotion/babel-plugin": "11.11.0",
44
44
  "@emotion/react": "11.11.1",
45
45
  "@emotion/styled": "11.11.0",
46
- "@types/react": "18.2.14",
46
+ "@types/react": "18.2.21",
47
47
  "@types/react-datepicker": "4.15.0",
48
- "@types/react-dom": "18.2.6",
48
+ "@types/react-dom": "18.2.7",
49
49
  "react": "18.2.0",
50
50
  "react-dom": "18.2.0"
51
51
  },
@@ -68,6 +68,6 @@
68
68
  "react-use-clipboard": "1.0.9",
69
69
  "reakit": "1.3.11",
70
70
  "@ultraviolet/themes": "1.2.1",
71
- "@ultraviolet/icons": "2.0.0"
71
+ "@ultraviolet/icons": "2.0.1"
72
72
  }
73
73
  }