@playkit-js/moderation 3.2.15 → 3.2.16-canary.0-020e453

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": "@playkit-js/moderation",
3
- "version": "3.2.15",
3
+ "version": "3.2.16-canary.0-020e453",
4
4
  "main": "dist/playkit-moderation.js",
5
5
  "private": false,
6
6
  "bugs": {
@@ -6,6 +6,8 @@ import {OverlayPortal} from '@playkit-js/common/dist/hoc/overlay-portal';
6
6
  import * as styles from './moderation.scss';
7
7
  import {DownIcon} from './down-icon';
8
8
 
9
+ // @ts-ignore
10
+ const {withKeyboardA11y} = KalturaPlayer.ui.utils;
9
11
  const {Overlay, PLAYER_SIZE} = KalturaPlayer.ui.components;
10
12
  const {withText, Text} = KalturaPlayer.ui.preacti18n;
11
13
  const {
@@ -35,7 +37,13 @@ interface ConnectProps {
35
37
  playerSize?: string;
36
38
  }
37
39
 
38
- type MergedProps = ModerationProps & ConnectProps;
40
+ interface KeyboardA11yProps {
41
+ handleKeyDown?: () => void;
42
+ setIsModal?: (isModel: boolean) => void;
43
+ addAccessibleChild?: (element: HTMLElement) => void;
44
+ }
45
+
46
+ type MergedProps = ModerationProps & ConnectProps & KeyboardA11yProps;
39
47
 
40
48
  interface ModerationState {
41
49
  reportContentType: number;
@@ -71,6 +79,7 @@ const mapStateToProps = (state: Record<string, any>) => ({
71
79
 
72
80
  @withText(translates)
73
81
  @connect(mapStateToProps)
82
+ @withKeyboardA11y
74
83
  export class Moderation extends Component<MergedProps, ModerationState> {
75
84
  _buttonRef: null | HTMLButtonElement = null;
76
85
  _textAreaElementRef: null | HTMLTextAreaElement = null;
@@ -81,6 +90,7 @@ export class Moderation extends Component<MergedProps, ModerationState> {
81
90
  if (this._buttonRef && this.props.closeButtonSelected) {
82
91
  this._buttonRef.focus();
83
92
  }
93
+ this.props.setIsModal && this.props.setIsModal(true);
84
94
  }
85
95
 
86
96
  private _onContentTypeChange = (id: number) => {
@@ -139,7 +149,7 @@ export class Moderation extends Component<MergedProps, ModerationState> {
139
149
  };
140
150
 
141
151
  render(props: MergedProps) {
142
- const {playerSize = '', reportLength, subtitle, onClick} = props;
152
+ const {playerSize = '', reportLength, subtitle, onClick, handleKeyDown, addAccessibleChild} = props;
143
153
  const {reportContent, reportContentType, isTextareaActive, loading} = this.state;
144
154
  if (playerSize === PLAYER_SIZE.TINY) {
145
155
  return null;
@@ -147,7 +157,7 @@ export class Moderation extends Component<MergedProps, ModerationState> {
147
157
  const submitButtonDisabled = reportContentType === -1;
148
158
  return (
149
159
  <OverlayPortal>
150
- <Overlay open onClose={onClick}>
160
+ <Overlay open onClose={onClick} handleKeyDown={handleKeyDown} addAccessibleChild={addAccessibleChild}>
151
161
  <div className={[styles.root, styles[playerSize]].join(' ')} data-testid="moderationRoot">
152
162
  <div className={styles.mainWrapper}>
153
163
  <div className={styles.title}>{this.props.reportTitle}</div>
@@ -158,6 +168,7 @@ export class Moderation extends Component<MergedProps, ModerationState> {
158
168
  tabIndex={0}
159
169
  ref={node => {
160
170
  this._buttonRef = node;
171
+ addAccessibleChild && addAccessibleChild(node!);
161
172
  }}
162
173
  aria-required="true"
163
174
  aria-expanded={this.state.open}
@@ -11,7 +11,7 @@
11
11
  "Spam / Commercials": "Spam / Commercials",
12
12
  "close": "Close",
13
13
  "report_placeholder": "Describe what you saw...",
14
- "default_content_type": "Choose a reason for reporting this content",
14
+ "default_content_type": "Choose a reason for reporting this content (required)",
15
15
  "report_title": "What’s wrong with this content?"
16
16
  }
17
17
  }