@atlaskit/editor-common 111.1.0 → 111.2.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,19 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 111.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ba0e1d49e14cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ba0e1d49e14cb) -
8
+ ENGHEALTH-40073: Make tables and extensions focusable if they have overscroll so that they can be
9
+ interacted with in an accessible way.
10
+
11
+ ### Patch Changes
12
+
13
+ - [`38bc4d5d6185c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38bc4d5d6185c) -
14
+ Fixes nested tables in SSR renderer
15
+ - Updated dependencies
16
+
3
17
  ## 111.1.0
4
18
 
5
19
  ### Minor Changes
@@ -14,6 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
14
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _react = _interopRequireDefault(require("react"));
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _shadowObserver = require("./shadowObserver");
18
19
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
19
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -163,13 +164,23 @@ function overflowShadow(Component, options) {
163
164
  showLeftShadow = _this$state.showLeftShadow,
164
165
  showRightShadow = _this$state.showRightShadow;
165
166
  var classNames = [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && _shadowObserver.shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
167
+
168
+ /**
169
+ * The widths have already been calculated to determine
170
+ * showRightShadow and showLeftShadow. If either is true,
171
+ * then the content is scrollable and we need to set the
172
+ * tabIndex to 0 to allow the user to scroll the content
173
+ * for a11y purposes.
174
+ */
175
+ var hasOverflowScroll = showRightShadow || showLeftShadow;
166
176
  return (
167
177
  /*#__PURE__*/
168
178
  // Ignored via go/ees005
169
- // eslint-disable-next-line react/jsx-props-no-spreading
170
179
  _react.default.createElement(Component, (0, _extends2.default)({
171
180
  handleRef: this.handleContainer,
181
+ tabIndex: hasOverflowScroll && (0, _platformFeatureFlags.fg)('platform_editor_dec_a11y_fixes') ? 0 : undefined,
172
182
  shadowClassNames: classNames
183
+ // eslint-disable-next-line react/jsx-props-no-spreading
173
184
  }, this.props))
174
185
  );
175
186
  }
@@ -11,6 +11,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
13
  var _analytics = require("../analytics");
14
+ var _utilities = require("../nesting/utilities");
14
15
  var _privacyFilter = require("./filter/privacy-filter");
15
16
  var _trackUnsupportedContent = require("./track-unsupported-content");
16
17
  var _validateUsingSpec = require("./validate-using-spec");
@@ -234,7 +235,10 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
234
235
  if ((0, _expValEquals.expValEquals)('platform_editor_ssr_renderer', 'isEnabled', true)) {
235
236
  // Validate ADF first before converting nested-table extensions into nested tables
236
237
  // This matches the renderer's behavior in render-document.ts
237
- entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent);
238
+ var allowNestedTables = (0, _utilities.isNestedTablesSupported)(schema);
239
+ entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
240
+ allowNestedTables: allowNestedTables
241
+ } : undefined);
238
242
 
239
243
  // Convert nested-table extensions into nested tables
240
244
  var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { ShadowObserver, shadowObserverClassNames } from './shadowObserver';
5
6
  export const shadowClassNames = {
6
7
  RIGHT_SHADOW: 'right-shadow',
@@ -135,13 +136,23 @@ export default function overflowShadow(Component, options) {
135
136
  showRightShadow
136
137
  } = this.state;
137
138
  const classNames = [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
139
+
140
+ /**
141
+ * The widths have already been calculated to determine
142
+ * showRightShadow and showLeftShadow. If either is true,
143
+ * then the content is scrollable and we need to set the
144
+ * tabIndex to 0 to allow the user to scroll the content
145
+ * for a11y purposes.
146
+ */
147
+ const hasOverflowScroll = showRightShadow || showLeftShadow;
138
148
  return (
139
149
  /*#__PURE__*/
140
150
  // Ignored via go/ees005
141
- // eslint-disable-next-line react/jsx-props-no-spreading
142
151
  React.createElement(Component, _extends({
143
152
  handleRef: this.handleContainer,
153
+ tabIndex: hasOverflowScroll && fg('platform_editor_dec_a11y_fixes') ? 0 : undefined,
144
154
  shadowClassNames: classNames
155
+ // eslint-disable-next-line react/jsx-props-no-spreading
145
156
  }, this.props))
146
157
  );
147
158
  }
@@ -3,6 +3,7 @@ import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
6
+ import { isNestedTablesSupported } from '../nesting/utilities';
6
7
  import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
7
8
  import { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
8
9
  import { validateADFEntity } from './validate-using-spec';
@@ -233,7 +234,10 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
233
234
  if (expValEquals('platform_editor_ssr_renderer', 'isEnabled', true)) {
234
235
  // Validate ADF first before converting nested-table extensions into nested tables
235
236
  // This matches the renderer's behavior in render-document.ts
236
- entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
237
+ const allowNestedTables = isNestedTablesSupported(schema);
238
+ entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
239
+ allowNestedTables
240
+ } : undefined);
237
241
 
238
242
  // Convert nested-table extensions into nested tables
239
243
  ({
@@ -8,6 +8,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
8
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import React from 'react';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import { ShadowObserver, shadowObserverClassNames } from './shadowObserver';
12
13
  export var shadowClassNames = {
13
14
  RIGHT_SHADOW: 'right-shadow',
@@ -155,13 +156,23 @@ export default function overflowShadow(Component, options) {
155
156
  showLeftShadow = _this$state.showLeftShadow,
156
157
  showRightShadow = _this$state.showRightShadow;
157
158
  var classNames = [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
159
+
160
+ /**
161
+ * The widths have already been calculated to determine
162
+ * showRightShadow and showLeftShadow. If either is true,
163
+ * then the content is scrollable and we need to set the
164
+ * tabIndex to 0 to allow the user to scroll the content
165
+ * for a11y purposes.
166
+ */
167
+ var hasOverflowScroll = showRightShadow || showLeftShadow;
158
168
  return (
159
169
  /*#__PURE__*/
160
170
  // Ignored via go/ees005
161
- // eslint-disable-next-line react/jsx-props-no-spreading
162
171
  React.createElement(Component, _extends({
163
172
  handleRef: this.handleContainer,
173
+ tabIndex: hasOverflowScroll && fg('platform_editor_dec_a11y_fixes') ? 0 : undefined,
164
174
  shadowClassNames: classNames
175
+ // eslint-disable-next-line react/jsx-props-no-spreading
165
176
  }, this.props))
166
177
  );
167
178
  }
@@ -3,6 +3,7 @@ import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
6
+ import { isNestedTablesSupported } from '../nesting/utilities';
6
7
  import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
7
8
  import { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
8
9
  import { validateADFEntity } from './validate-using-spec';
@@ -226,7 +227,10 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
226
227
  if (expValEquals('platform_editor_ssr_renderer', 'isEnabled', true)) {
227
228
  // Validate ADF first before converting nested-table extensions into nested tables
228
229
  // This matches the renderer's behavior in render-document.ts
229
- entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
230
+ var allowNestedTables = isNestedTablesSupported(schema);
231
+ entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
232
+ allowNestedTables: allowNestedTables
233
+ } : undefined);
230
234
 
231
235
  // Convert nested-table extensions into nested tables
232
236
  var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
@@ -8,6 +8,7 @@ export interface OverflowShadowProps {
8
8
  disableTableOverflowShadow?: boolean;
9
9
  handleRef?: (ref: HTMLElement | null) => void;
10
10
  shadowClassNames?: string;
11
+ tabIndex?: number;
11
12
  }
12
13
  export interface OverflowShadowState {
13
14
  showLeftShadow: boolean;
@@ -8,6 +8,7 @@ export interface OverflowShadowProps {
8
8
  disableTableOverflowShadow?: boolean;
9
9
  handleRef?: (ref: HTMLElement | null) => void;
10
10
  shadowClassNames?: string;
11
+ tabIndex?: number;
11
12
  }
12
13
  export interface OverflowShadowState {
13
14
  showLeftShadow: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "111.1.0",
3
+ "version": "111.2.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"