@playkit-js/hotspots 3.2.27 → 3.2.28

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/hotspots",
3
- "version": "3.2.27",
3
+ "version": "3.2.28",
4
4
  "private": false,
5
5
  "bugs": {
6
6
  "url": "https://github.com/kaltura/playkit-js-hotspots/issues"
@@ -193,7 +193,7 @@ export default class Hotspot extends Component<Props, State> {
193
193
  };
194
194
 
195
195
  return (
196
- <A11yWrapper onClick={this.handleClick} role='alert' aria-live="polite">
196
+ <A11yWrapper onClick={this.handleClick}>
197
197
  <div ref={(ref) => (this.hotspotRef = ref)} tabIndex={0} role="button" aria-label={label} aria-disabled={disableClick} style={containerStyles} data-testid="hotspots_hotspot">
198
198
  <div style={buttonStyles}>{label}</div>
199
199
  </div>
@@ -10,6 +10,11 @@ const translates = {
10
10
  <Text id="hotspots.hotspot_removed" fields={{ hotspotLabel: '' }}>
11
11
  {`{hotspotLabel} hotspot removed`}
12
12
  </Text>
13
+ ),
14
+ hotspotAdded: (
15
+ <Text id="hotspots.hotspot_added" fields={{ hotspotLabel: '' }}>
16
+ {`{hotspotLabel} hotspot added`}
17
+ </Text>
13
18
  )
14
19
  };
15
20
 
@@ -30,6 +35,7 @@ export interface Props {
30
35
  sendAnalytics(event: AnalyticsEvents): void;
31
36
  dispatcher(name: string, payload?: any): void;
32
37
  hotspotRemoved?: string;
38
+ hotspotAdded?: string;
33
39
  player?: any;
34
40
  }
35
41
 
@@ -51,6 +57,8 @@ export default class HotspotWrapper extends Component<Props> {
51
57
  );
52
58
 
53
59
  let announced = false;
60
+
61
+ // Announce removed hotspots
54
62
  this.previousHotspotMap.forEach((label, id) => {
55
63
  if (!currentMap.has(id) && !announced) {
56
64
  if (this.props.hotspotRemoved) {
@@ -61,6 +69,19 @@ export default class HotspotWrapper extends Component<Props> {
61
69
  }
62
70
  });
63
71
 
72
+ // Announce added hotspots
73
+ if (!announced) {
74
+ currentMap.forEach((label, id) => {
75
+ if (!this.previousHotspotMap.has(id) && !announced) {
76
+ if (this.props.hotspotAdded) {
77
+ const message = this.props.hotspotAdded.replace('{hotspotLabel}', label);
78
+ this.announceHotspotChange(message);
79
+ }
80
+ announced = true;
81
+ }
82
+ });
83
+ }
84
+
64
85
  this.previousHotspotMap = currentMap;
65
86
  }
66
87