@atlaskit/editor-plugin-accessibility-utils 2.0.4 → 2.0.5
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,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-accessibility-utils
|
|
2
2
|
|
|
3
|
+
## 2.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#145138](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145138)
|
|
8
|
+
[`0ba0ff24c0e33`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0ba0ff24c0e33) -
|
|
9
|
+
Enable useSharedPluginStateSelector in accessibility, alignment, annotation and avatar-group
|
|
10
|
+
plugins
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 2.0.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -10,7 +10,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
16
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
15
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -82,12 +84,24 @@ var accessibilityUtilsPlugin = exports.accessibilityUtilsPlugin = function acces
|
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
function ContentComponent(_ref2) {
|
|
85
|
-
var _accessibilityUtilsSt;
|
|
86
87
|
var api = _ref2.api;
|
|
87
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['accessibilityUtils']
|
|
88
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['accessibilityUtils'], {
|
|
89
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
90
|
+
}),
|
|
88
91
|
accessibilityUtilsState = _useSharedPluginState.accessibilityUtilsState;
|
|
89
|
-
var
|
|
90
|
-
|
|
92
|
+
var ariaLiveElementAttributesSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.ariaLiveElementAttributes', {
|
|
93
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
94
|
+
});
|
|
95
|
+
var ariaLiveElementAttributes = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? ariaLiveElementAttributesSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes;
|
|
96
|
+
var keySelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.key', {
|
|
97
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
98
|
+
});
|
|
99
|
+
var key = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? keySelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key;
|
|
100
|
+
var messageSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.message', {
|
|
101
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
102
|
+
});
|
|
103
|
+
var message = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? messageSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message;
|
|
104
|
+
var role = (ariaLiveElementAttributes === null || ariaLiveElementAttributes === void 0 ? void 0 : ariaLiveElementAttributes.priority) === 'important' ? 'alert' : 'status';
|
|
91
105
|
return /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, (0, _extends2.default)({
|
|
92
106
|
testId: 'accessibility-message-wrapper',
|
|
93
107
|
role: role
|
|
@@ -95,5 +109,5 @@ function ContentComponent(_ref2) {
|
|
|
95
109
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
96
110
|
}, role === 'alert' && {
|
|
97
111
|
key: key
|
|
98
|
-
}),
|
|
112
|
+
}), message);
|
|
99
113
|
}
|
|
@@ -2,7 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
8
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
7
9
|
export const accessibilityUtilsPluginKey = new PluginKey('accessibilityUtilsPlugin');
|
|
8
10
|
export const accessibilityUtilsPlugin = ({
|
|
@@ -76,12 +78,24 @@ export const accessibilityUtilsPlugin = ({
|
|
|
76
78
|
function ContentComponent({
|
|
77
79
|
api
|
|
78
80
|
}) {
|
|
79
|
-
var _accessibilityUtilsSt;
|
|
80
81
|
const {
|
|
81
82
|
accessibilityUtilsState
|
|
82
|
-
} = useSharedPluginState(api, ['accessibilityUtils']
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
} = useSharedPluginState(api, ['accessibilityUtils'], {
|
|
84
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
85
|
+
});
|
|
86
|
+
const ariaLiveElementAttributesSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.ariaLiveElementAttributes', {
|
|
87
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
88
|
+
});
|
|
89
|
+
const ariaLiveElementAttributes = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? ariaLiveElementAttributesSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes;
|
|
90
|
+
const keySelector = useSharedPluginStateSelector(api, 'accessibilityUtils.key', {
|
|
91
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
92
|
+
});
|
|
93
|
+
const key = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? keySelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key;
|
|
94
|
+
const messageSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.message', {
|
|
95
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
96
|
+
});
|
|
97
|
+
const message = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? messageSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message;
|
|
98
|
+
const role = (ariaLiveElementAttributes === null || ariaLiveElementAttributes === void 0 ? void 0 : ariaLiveElementAttributes.priority) === 'important' ? 'alert' : 'status';
|
|
85
99
|
return /*#__PURE__*/React.createElement(VisuallyHidden, _extends({
|
|
86
100
|
testId: 'accessibility-message-wrapper',
|
|
87
101
|
role: role
|
|
@@ -89,5 +103,5 @@ function ContentComponent({
|
|
|
89
103
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
90
104
|
}, role === 'alert' && {
|
|
91
105
|
key
|
|
92
|
-
}),
|
|
106
|
+
}), message);
|
|
93
107
|
}
|
|
@@ -5,7 +5,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
11
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
10
12
|
export var accessibilityUtilsPluginKey = new PluginKey('accessibilityUtilsPlugin');
|
|
11
13
|
export var accessibilityUtilsPlugin = function accessibilityUtilsPlugin(_ref) {
|
|
@@ -75,12 +77,24 @@ export var accessibilityUtilsPlugin = function accessibilityUtilsPlugin(_ref) {
|
|
|
75
77
|
};
|
|
76
78
|
};
|
|
77
79
|
function ContentComponent(_ref2) {
|
|
78
|
-
var _accessibilityUtilsSt;
|
|
79
80
|
var api = _ref2.api;
|
|
80
|
-
var _useSharedPluginState = useSharedPluginState(api, ['accessibilityUtils']
|
|
81
|
+
var _useSharedPluginState = useSharedPluginState(api, ['accessibilityUtils'], {
|
|
82
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
83
|
+
}),
|
|
81
84
|
accessibilityUtilsState = _useSharedPluginState.accessibilityUtilsState;
|
|
82
|
-
var
|
|
83
|
-
|
|
85
|
+
var ariaLiveElementAttributesSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.ariaLiveElementAttributes', {
|
|
86
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
87
|
+
});
|
|
88
|
+
var ariaLiveElementAttributes = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? ariaLiveElementAttributesSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes;
|
|
89
|
+
var keySelector = useSharedPluginStateSelector(api, 'accessibilityUtils.key', {
|
|
90
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
91
|
+
});
|
|
92
|
+
var key = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? keySelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key;
|
|
93
|
+
var messageSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.message', {
|
|
94
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
95
|
+
});
|
|
96
|
+
var message = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? messageSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message;
|
|
97
|
+
var role = (ariaLiveElementAttributes === null || ariaLiveElementAttributes === void 0 ? void 0 : ariaLiveElementAttributes.priority) === 'important' ? 'alert' : 'status';
|
|
84
98
|
return /*#__PURE__*/React.createElement(VisuallyHidden, _extends({
|
|
85
99
|
testId: 'accessibility-message-wrapper',
|
|
86
100
|
role: role
|
|
@@ -88,5 +102,5 @@ function ContentComponent(_ref2) {
|
|
|
88
102
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
89
103
|
}, role === 'alert' && {
|
|
90
104
|
key: key
|
|
91
|
-
}),
|
|
105
|
+
}), message);
|
|
92
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-accessibility-utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Accessibility utils for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^103.
|
|
34
|
+
"@atlaskit/editor-common": "^103.18.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
36
|
+
"@atlaskit/tmp-editor-statsig": "^4.14.0",
|
|
36
37
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
37
38
|
"@babel/runtime": "^7.0.0"
|
|
38
39
|
},
|
|
@@ -41,10 +42,10 @@
|
|
|
41
42
|
"react-dom": "^18.2.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@af/integration-testing": "
|
|
45
|
-
"@af/visual-regression": "
|
|
46
|
-
"@atlaskit/ssr": "
|
|
47
|
-
"@atlaskit/visual-regression": "
|
|
45
|
+
"@af/integration-testing": "workspace:^",
|
|
46
|
+
"@af/visual-regression": "workspace:^",
|
|
47
|
+
"@atlaskit/ssr": "workspace:^",
|
|
48
|
+
"@atlaskit/visual-regression": "workspace:^",
|
|
48
49
|
"@testing-library/react": "^13.4.0",
|
|
49
50
|
"typescript": "~5.4.2",
|
|
50
51
|
"wait-for-expect": "^1.2.0"
|