@atlaskit/popup 1.16.0 → 1.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#91673](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91673)
8
+ [`e757c83a22ee`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e757c83a22ee) -
9
+ Add new props for improving accessibility: `role`, `label` and `titleId`.
10
+
3
11
  ## 1.16.0
4
12
 
5
13
  ### Minor Changes
@@ -77,7 +77,10 @@ function PopperWrapper(_ref) {
77
77
  shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
78
78
  shouldRenderToParent = _ref.shouldRenderToParent,
79
79
  shouldDisableFocusLock = _ref.shouldDisableFocusLock,
80
- strategy = _ref.strategy;
80
+ strategy = _ref.strategy,
81
+ role = _ref.role,
82
+ label = _ref.label,
83
+ titleId = _ref.titleId;
81
84
  var _useState = (0, _react.useState)(null),
82
85
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
83
86
  popupRef = _useState2[0],
@@ -131,6 +134,9 @@ function PopperWrapper(_ref) {
131
134
  "data-ds--level": currentLevel,
132
135
  "data-placement": placement,
133
136
  "data-testid": testId,
137
+ role: role,
138
+ "aria-label": label,
139
+ "aria-labelledby": titleId,
134
140
  ref: function ref(node) {
135
141
  if (node) {
136
142
  if (typeof _ref3 === 'function') {
package/dist/cjs/popup.js CHANGED
@@ -45,7 +45,10 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
45
45
  shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
46
46
  _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
47
47
  shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
48
- strategy = _ref.strategy;
48
+ strategy = _ref.strategy,
49
+ role = _ref.role,
50
+ label = _ref.label,
51
+ titleId = _ref.titleId;
49
52
  var _useState = (0, _react.useState)(null),
50
53
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
51
54
  triggerRef = _useState2[0],
@@ -71,7 +74,10 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
71
74
  shouldRenderToParent: shouldRenderToParent,
72
75
  shouldDisableFocusLock: shouldDisableFocusLock,
73
76
  triggerRef: triggerRef,
74
- strategy: strategy
77
+ strategy: strategy,
78
+ role: role,
79
+ label: label,
80
+ titleId: titleId
75
81
  }));
76
82
  return (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
77
83
  var ref = _ref2.ref;
@@ -66,7 +66,10 @@ function PopperWrapper({
66
66
  shouldUseCaptureOnOutsideClick,
67
67
  shouldRenderToParent,
68
68
  shouldDisableFocusLock,
69
- strategy
69
+ strategy,
70
+ role,
71
+ label,
72
+ titleId
70
73
  }) {
71
74
  const [popupRef, setPopupRef] = useState(null);
72
75
  const [initialFocusRef, setInitialFocusRef] = useState(null);
@@ -115,6 +118,9 @@ function PopperWrapper({
115
118
  "data-ds--level": currentLevel,
116
119
  "data-placement": placement,
117
120
  "data-testid": testId,
121
+ role: role,
122
+ "aria-label": label,
123
+ "aria-labelledby": titleId,
118
124
  ref: node => {
119
125
  if (node) {
120
126
  if (typeof ref === 'function') {
@@ -28,7 +28,10 @@ export const Popup = /*#__PURE__*/memo(({
28
28
  shouldUseCaptureOnOutsideClick = false,
29
29
  shouldRenderToParent = false,
30
30
  shouldDisableFocusLock = false,
31
- strategy
31
+ strategy,
32
+ role,
33
+ label,
34
+ titleId
32
35
  }) => {
33
36
  const [triggerRef, setTriggerRef] = useState(null);
34
37
  const getMergedTriggerRef = useGetMemoizedMergedTriggerRef();
@@ -52,7 +55,10 @@ export const Popup = /*#__PURE__*/memo(({
52
55
  shouldRenderToParent: shouldRenderToParent,
53
56
  shouldDisableFocusLock: shouldDisableFocusLock,
54
57
  triggerRef: triggerRef,
55
- strategy: strategy
58
+ strategy: strategy,
59
+ role: role,
60
+ label: label,
61
+ titleId: titleId
56
62
  }));
57
63
  return jsx(Manager, null, jsx(Reference, null, ({
58
64
  ref
@@ -70,7 +70,10 @@ function PopperWrapper(_ref) {
70
70
  shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
71
71
  shouldRenderToParent = _ref.shouldRenderToParent,
72
72
  shouldDisableFocusLock = _ref.shouldDisableFocusLock,
73
- strategy = _ref.strategy;
73
+ strategy = _ref.strategy,
74
+ role = _ref.role,
75
+ label = _ref.label,
76
+ titleId = _ref.titleId;
74
77
  var _useState = useState(null),
75
78
  _useState2 = _slicedToArray(_useState, 2),
76
79
  popupRef = _useState2[0],
@@ -124,6 +127,9 @@ function PopperWrapper(_ref) {
124
127
  "data-ds--level": currentLevel,
125
128
  "data-placement": placement,
126
129
  "data-testid": testId,
130
+ role: role,
131
+ "aria-label": label,
132
+ "aria-labelledby": titleId,
127
133
  ref: function ref(node) {
128
134
  if (node) {
129
135
  if (typeof _ref3 === 'function') {
package/dist/esm/popup.js CHANGED
@@ -37,7 +37,10 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
37
37
  shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
38
38
  _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
39
39
  shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
40
- strategy = _ref.strategy;
40
+ strategy = _ref.strategy,
41
+ role = _ref.role,
42
+ label = _ref.label,
43
+ titleId = _ref.titleId;
41
44
  var _useState = useState(null),
42
45
  _useState2 = _slicedToArray(_useState, 2),
43
46
  triggerRef = _useState2[0],
@@ -63,7 +66,10 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
63
66
  shouldRenderToParent: shouldRenderToParent,
64
67
  shouldDisableFocusLock: shouldDisableFocusLock,
65
68
  triggerRef: triggerRef,
66
- strategy: strategy
69
+ strategy: strategy,
70
+ role: role,
71
+ label: label,
72
+ titleId: titleId
67
73
  }));
68
74
  return jsx(Manager, null, jsx(Reference, null, function (_ref2) {
69
75
  var ref = _ref2.ref;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, strategy, }: PopperWrapperProps): jsx.JSX.Element;
3
+ declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -61,6 +61,11 @@ export interface PopupComponentProps {
61
61
  * The default is `false`.
62
62
  */
63
63
  shouldRenderToParent?: boolean;
64
+ /**
65
+ * Use this to set the accessibility role for the popup.
66
+ * We strongly recommend using only `menu` or `dialog`.
67
+ */
68
+ role?: string;
64
69
  }
65
70
  interface BaseProps {
66
71
  /**
@@ -145,7 +150,7 @@ interface BaseProps {
145
150
  */
146
151
  shouldRenderToParent?: boolean;
147
152
  /**
148
- * This allows the Popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
153
+ * This allows the popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
149
154
  * The default is `false`.
150
155
  */
151
156
  shouldDisableFocusLock?: boolean;
@@ -154,6 +159,22 @@ interface BaseProps {
154
159
  * The default is `fixed`.
155
160
  */
156
161
  strategy?: 'absolute' | 'fixed';
162
+ /**
163
+ * Use this to set the accessibility role for the popup.
164
+ * We strongly recommend using only `menu` or `dialog`.
165
+ * Must be used along with `label` or `titleId`.
166
+ */
167
+ role?: string;
168
+ /**
169
+ * Refers to an `aria-label` attribute. Sets an accessible name for the popup to announce it to users of assistive technology.
170
+ * Usage of either this, or the `titleId` attribute is strongly recommended.
171
+ */
172
+ label?: string;
173
+ /**
174
+ * Id referenced by the popup `aria-labelledby` attribute.
175
+ * Usage of either this, or the `label` attribute is strongly recommended.
176
+ */
177
+ titleId?: string;
157
178
  }
158
179
  export interface PopupProps extends BaseProps {
159
180
  /**
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, strategy, }: PopperWrapperProps): jsx.JSX.Element;
3
+ declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -61,6 +61,11 @@ export interface PopupComponentProps {
61
61
  * The default is `false`.
62
62
  */
63
63
  shouldRenderToParent?: boolean;
64
+ /**
65
+ * Use this to set the accessibility role for the popup.
66
+ * We strongly recommend using only `menu` or `dialog`.
67
+ */
68
+ role?: string;
64
69
  }
65
70
  interface BaseProps {
66
71
  /**
@@ -148,7 +153,7 @@ interface BaseProps {
148
153
  */
149
154
  shouldRenderToParent?: boolean;
150
155
  /**
151
- * This allows the Popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
156
+ * This allows the popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
152
157
  * The default is `false`.
153
158
  */
154
159
  shouldDisableFocusLock?: boolean;
@@ -157,6 +162,22 @@ interface BaseProps {
157
162
  * The default is `fixed`.
158
163
  */
159
164
  strategy?: 'absolute' | 'fixed';
165
+ /**
166
+ * Use this to set the accessibility role for the popup.
167
+ * We strongly recommend using only `menu` or `dialog`.
168
+ * Must be used along with `label` or `titleId`.
169
+ */
170
+ role?: string;
171
+ /**
172
+ * Refers to an `aria-label` attribute. Sets an accessible name for the popup to announce it to users of assistive technology.
173
+ * Usage of either this, or the `titleId` attribute is strongly recommended.
174
+ */
175
+ label?: string;
176
+ /**
177
+ * Id referenced by the popup `aria-labelledby` attribute.
178
+ * Usage of either this, or the `label` attribute is strongly recommended.
179
+ */
180
+ titleId?: string;
160
181
  }
161
182
  export interface PopupProps extends BaseProps {
162
183
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"