@microsoft/omnichannel-chat-components 1.1.19 → 1.2.0-main.5ebd4eb

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.
Files changed (59) hide show
  1. package/README.md +140 -1
  2. package/lib/cjs/common/Constants.js +8 -11
  3. package/lib/cjs/components/callingcontainer/subcomponents/CurrentCall/CurrentCall.js +10 -3
  4. package/lib/cjs/components/callingcontainer/subcomponents/Timer/Timer.js +10 -1
  5. package/lib/cjs/components/chatbutton/ChatButton.blankAnnouncements.a11y.spec.js +158 -0
  6. package/lib/cjs/components/chatbutton/ChatButton.browseMode.a11y.spec.js +227 -0
  7. package/lib/cjs/components/chatbutton/ChatButton.browseMode.unfixed.a11y.spec.js +112 -0
  8. package/lib/cjs/components/chatbutton/ChatButton.js +52 -16
  9. package/lib/cjs/components/common/subcomponents/CloseButton.js +1 -3
  10. package/lib/cjs/components/confirmationpane/ConfirmationPane.js +10 -8
  11. package/lib/cjs/components/confirmationpane/common/defaultProps/defaultConfirmationPaneControlProps.js +1 -0
  12. package/lib/cjs/components/footer/subcomponents/AudioNotificationButton.js +11 -4
  13. package/lib/cjs/components/footer/subcomponents/DownloadTranscriptButton.js +1 -3
  14. package/lib/cjs/components/footer/subcomponents/EmailTranscriptButton.js +1 -3
  15. package/lib/cjs/components/header/Header.js +16 -4
  16. package/lib/cjs/components/header/common/defaultStyles/defaultHeaderStyleProps.js +23 -0
  17. package/lib/cjs/components/header/subcomponents/MinimizeButton.js +1 -3
  18. package/lib/cjs/components/inputvalidationpane/InputValidationPane.js +34 -14
  19. package/lib/cjs/components/inputvalidationpane/common/default/defaultProps/defaultInputValidationPaneControlProps.js +1 -0
  20. package/lib/cjs/components/notificationpane/subcomponents/CloseChatButton.js +1 -3
  21. package/lib/cjs/components/notificationpane/subcomponents/DismissButton.js +1 -3
  22. package/lib/cjs/components/prechatsurveypane/PreChatSurveyPane.js +94 -17
  23. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultichoiceInputStyles.js +1 -0
  24. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.js +1 -0
  25. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.js +1 -0
  26. package/lib/cjs/package.json +1 -0
  27. package/lib/cjs/services/EventQueue.js +4 -7
  28. package/lib/esm/common/Constants.js +1 -1
  29. package/lib/esm/components/callingcontainer/subcomponents/CurrentCall/CurrentCall.js +10 -3
  30. package/lib/esm/components/callingcontainer/subcomponents/Timer/Timer.js +10 -1
  31. package/lib/esm/components/chatbutton/ChatButton.blankAnnouncements.a11y.spec.js +155 -0
  32. package/lib/esm/components/chatbutton/ChatButton.browseMode.a11y.spec.js +224 -0
  33. package/lib/esm/components/chatbutton/ChatButton.browseMode.unfixed.a11y.spec.js +108 -0
  34. package/lib/esm/components/chatbutton/ChatButton.js +53 -16
  35. package/lib/esm/components/common/subcomponents/CloseButton.js +1 -3
  36. package/lib/esm/components/confirmationpane/ConfirmationPane.js +10 -8
  37. package/lib/esm/components/confirmationpane/common/defaultProps/defaultConfirmationPaneControlProps.js +1 -0
  38. package/lib/esm/components/footer/subcomponents/AudioNotificationButton.js +11 -4
  39. package/lib/esm/components/footer/subcomponents/DownloadTranscriptButton.js +1 -3
  40. package/lib/esm/components/footer/subcomponents/EmailTranscriptButton.js +1 -3
  41. package/lib/esm/components/header/Header.js +16 -4
  42. package/lib/esm/components/header/common/defaultStyles/defaultHeaderStyleProps.js +23 -0
  43. package/lib/esm/components/header/subcomponents/MinimizeButton.js +1 -3
  44. package/lib/esm/components/inputvalidationpane/InputValidationPane.js +34 -14
  45. package/lib/esm/components/inputvalidationpane/common/default/defaultProps/defaultInputValidationPaneControlProps.js +1 -0
  46. package/lib/esm/components/notificationpane/subcomponents/CloseChatButton.js +1 -3
  47. package/lib/esm/components/notificationpane/subcomponents/DismissButton.js +1 -3
  48. package/lib/esm/components/prechatsurveypane/PreChatSurveyPane.js +94 -16
  49. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultichoiceInputStyles.js +1 -0
  50. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.js +1 -0
  51. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.js +1 -0
  52. package/lib/types/common/Constants.d.ts +2 -0
  53. package/lib/types/components/chatbutton/ChatButton.blankAnnouncements.a11y.spec.d.ts +1 -0
  54. package/lib/types/components/chatbutton/ChatButton.browseMode.a11y.spec.d.ts +1 -0
  55. package/lib/types/components/chatbutton/ChatButton.browseMode.unfixed.a11y.spec.d.ts +1 -0
  56. package/lib/types/components/confirmationpane/interfaces/IConfirmationPaneControlProps.d.ts +1 -0
  57. package/lib/types/components/header/interfaces/IHeaderStyleProps.d.ts +12 -0
  58. package/lib/types/components/inputvalidationpane/interfaces/IInputValidationPaneControlProps.d.ts +1 -0
  59. package/package.json +41 -32
@@ -0,0 +1,155 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import "@testing-library/jest-dom/extend-expect";
3
+ import { cleanup, render } from "@testing-library/react";
4
+ import { BroadcastServiceInitialize } from "../../services/BroadcastService";
5
+ import ChatButton from "./ChatButton";
6
+ import LoadingPane from "../loadingpane/LoadingPane";
7
+ import React from "react";
8
+ import { defaultChatButtonProps } from "./common/defaultProps/defaultChatButtonProps";
9
+ import { defaultLoadingPaneProps } from "../loadingpane/common/defaultProps/defaultLoadingPaneProps";
10
+
11
+ /**
12
+ * Repro / catcher for internal tracking — screen reader announces hidden / irrelevant
13
+ * text such as "blank" while navigating the chat surface. NVDA / JAWS announce
14
+ * "blank" when they encounter:
15
+ * - an element with an announceable role (button, link, textbox, listitem,
16
+ * progressbar, etc.) that has an empty accessible name (no aria-label, no
17
+ * aria-labelledby, no associated <label>, and no own text content), OR
18
+ * - a live region (`aria-live="polite"` / `aria-live="assertive"`) that is
19
+ * mounted with empty text content (each tick announces "blank").
20
+ *
21
+ * This catcher walks several rendered LCW surfaces and asserts neither pattern
22
+ * is present. Deterministic DOM contract — no SR needed.
23
+ *
24
+ * Surfaces covered today:
25
+ * - ChatButton (default props) — regression guard; passes today.
26
+ * - ChatButton with notification bubble forced visible at unreadCount=0 —
27
+ * regression guard for the empty-live-region path; passes today.
28
+ * - LoadingPane (default props) — regression guard; passes today.
29
+ *
30
+ * Scope note: the original bug surfaces inside WebChat-rendered chat session
31
+ * content (message bubbles, attachments, agent-supplied HTML), which is not
32
+ * reachable from chat-components unit tests. The Playwright catcher
33
+ * `automation_tests/e2e/areas/accessibility/blankAnnouncements.spec.ts` on
34
+ * `chore/a11y-tooling-foundation` walks the full a11y tree of a built
35
+ * `dist/out.js` and is the right vehicle for enumerating per-offender fixes.
36
+ * Promote additional surfaces here as they are wired into the catcher harness.
37
+ */
38
+
39
+ beforeAll(() => {
40
+ BroadcastServiceInitialize("testChannel");
41
+ });
42
+ afterEach(() => {
43
+ cleanup();
44
+ });
45
+ const ANNOUNCEABLE_ROLES = new Set(["button", "link", "textbox", "combobox", "listbox", "listitem", "menu", "menuitem", "checkbox", "radio", "switch", "tab", "treeitem", "option", "searchbox", "progressbar", "alert", "status"]);
46
+ const ANNOUNCEABLE_TAGS = new Set(["button", "a", "input", "select", "textarea"]);
47
+ const isInsideAriaHidden = el => {
48
+ let cursor = el;
49
+ while (cursor) {
50
+ if (cursor.getAttribute("aria-hidden") === "true") return true;
51
+ cursor = cursor.parentElement;
52
+ }
53
+ return false;
54
+ };
55
+ const accessibleNameOf = el => {
56
+ const ariaLabel = (el.getAttribute("aria-label") || "").trim();
57
+ if (ariaLabel) return ariaLabel;
58
+ const labelledBy = (el.getAttribute("aria-labelledby") || "").trim();
59
+ if (labelledBy) {
60
+ const referenced = labelledBy.split(/\s+/).map(id => {
61
+ var _document$getElementB;
62
+ return ((_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.textContent) || "";
63
+ }).join(" ").trim();
64
+ if (referenced) return referenced;
65
+ }
66
+ if (el.tagName.toLowerCase() === "input") {
67
+ const id = el.id;
68
+ if (id) {
69
+ var _label$textContent;
70
+ const label = document.querySelector(`label[for="${CSS.escape(id)}"]`);
71
+ const labelText = label === null || label === void 0 || (_label$textContent = label.textContent) === null || _label$textContent === void 0 ? void 0 : _label$textContent.trim();
72
+ if (labelText) return labelText;
73
+ }
74
+ const placeholder = (el.getAttribute("placeholder") || "").trim();
75
+ if (placeholder) return placeholder;
76
+ }
77
+ if (el.tagName.toLowerCase() === "a") {
78
+ const title = (el.getAttribute("title") || "").trim();
79
+ if (title) return title;
80
+ }
81
+ return (el.textContent || "").trim();
82
+ };
83
+ const isAnnounceable = el => {
84
+ if (isInsideAriaHidden(el)) return false;
85
+ const role = (el.getAttribute("role") || "").toLowerCase();
86
+ if (role === "presentation" || role === "none") return false;
87
+ if (role && ANNOUNCEABLE_ROLES.has(role)) return true;
88
+ if (ANNOUNCEABLE_TAGS.has(el.tagName.toLowerCase())) {
89
+ // <input type="hidden"> is not announceable.
90
+ if (el.tagName.toLowerCase() === "input" && (el.getAttribute("type") || "").toLowerCase() === "hidden") {
91
+ return false;
92
+ }
93
+ return true;
94
+ }
95
+ return false;
96
+ };
97
+ const findEmptyAnnounceable = root => {
98
+ return Array.from(root.querySelectorAll("*")).filter(el => isAnnounceable(el) && accessibleNameOf(el) === "");
99
+ };
100
+ const findEmptyLiveRegions = root => {
101
+ return Array.from(root.querySelectorAll("[aria-live]")).filter(el => {
102
+ if (isInsideAriaHidden(el)) return false;
103
+ const live = (el.getAttribute("aria-live") || "").toLowerCase();
104
+ if (live !== "polite" && live !== "assertive") return false;
105
+ return (el.textContent || "").trim() === "";
106
+ });
107
+ };
108
+ const summarize = offenders => offenders.map(el => ({
109
+ tag: el.tagName.toLowerCase(),
110
+ id: el.id,
111
+ role: el.getAttribute("role"),
112
+ ariaLabel: el.getAttribute("aria-label"),
113
+ ariaLabelledBy: el.getAttribute("aria-labelledby"),
114
+ classes: el.className
115
+ }));
116
+ describe("ChatButton — 'blank' / empty-name announcements (internal tracking regression guard)", () => {
117
+ it("no announceable role/tag in the chat-button subtree may have an empty accessible name", () => {
118
+ const _render = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
119
+ container = _render.container;
120
+ const button = container.firstElementChild;
121
+ expect(button).not.toBeNull();
122
+ expect(summarize(findEmptyAnnounceable(button))).toEqual([]);
123
+ });
124
+ it("no live region (aria-live=polite/assertive) in the chat-button subtree may be mounted with empty text", () => {
125
+ const props = {
126
+ ...defaultChatButtonProps,
127
+ controlProps: {
128
+ ...defaultChatButtonProps.controlProps,
129
+ unreadMessageCount: "0",
130
+ hideNotificationBubble: false
131
+ }
132
+ };
133
+ const _render2 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
134
+ container = _render2.container;
135
+ const button = container.firstElementChild;
136
+ expect(button).not.toBeNull();
137
+ expect(summarize(findEmptyLiveRegions(button))).toEqual([]);
138
+ });
139
+ });
140
+ describe("LoadingPane — 'blank' / empty-name announcements (internal tracking regression guard)", () => {
141
+ it("no announceable role/tag in the loading-pane subtree may have an empty accessible name", () => {
142
+ const _render3 = render(/*#__PURE__*/React.createElement(LoadingPane, defaultLoadingPaneProps)),
143
+ container = _render3.container;
144
+ const pane = container.firstElementChild;
145
+ expect(pane).not.toBeNull();
146
+ expect(summarize(findEmptyAnnounceable(pane))).toEqual([]);
147
+ });
148
+ it("no live region (aria-live=polite/assertive) in the loading-pane subtree may be mounted with empty text", () => {
149
+ const _render4 = render(/*#__PURE__*/React.createElement(LoadingPane, defaultLoadingPaneProps)),
150
+ container = _render4.container;
151
+ const pane = container.firstElementChild;
152
+ expect(pane).not.toBeNull();
153
+ expect(summarize(findEmptyLiveRegions(pane))).toEqual([]);
154
+ });
155
+ });
@@ -0,0 +1,224 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import "@testing-library/jest-dom/extend-expect";
3
+ import { cleanup, render } from "@testing-library/react";
4
+ import { BroadcastServiceInitialize } from "../../services/BroadcastService";
5
+ import ChatButton from "./ChatButton";
6
+ import React from "react";
7
+ import { defaultChatButtonProps } from "./common/defaultProps/defaultChatButtonProps";
8
+
9
+ /**
10
+ * Repro / catcher for internal tracking — NVDA / JAWS in browse mode (virtual cursor)
11
+ * land on "Let's Chat, We're Online" multiple times when navigating with the
12
+ * down-arrow key.
13
+ *
14
+ * Root cause in code: `ChatButton` renders a Fluent UI `<Stack role="button">`
15
+ * with `tabIndex={0}` whose accessible name is computed from its visible
16
+ * children — a `<Label>` for the title (e.g. "Let's Chat!") and a `<Label>`
17
+ * for the subtitle (e.g. "We're online."). In browse mode, NVDA / JAWS treat
18
+ * the button itself AND each inner text node as separate virtual-cursor stops,
19
+ * each carrying the same announceable name fragments. There is no
20
+ * `aria-label` set by default, and the inner labels are not marked
21
+ * `aria-hidden="true"` (which is what would collapse them into a single
22
+ * announcement under the button container).
23
+ *
24
+ * Catcher contract: in the rendered chat-button subtree, at most ONE element
25
+ * may expose each of the title / subtitle strings as an announceable name
26
+ * source. An "announceable name source" here is:
27
+ * - an `aria-label` attribute on a focusable / role-bearing element, OR
28
+ * - a visible `<Label>` (or other text-bearing element) that is NOT
29
+ * `aria-hidden="true"` and is not nested inside an element that is
30
+ * `aria-hidden="true"`.
31
+ *
32
+ * Regression guard: in the rendered DOM, the parent role=button Stack owns a
33
+ * single consolidated aria-label (synthesized from title + subtitle, plus
34
+ * unread-count fragment when applicable) and the inner Labels live inside an
35
+ * aria-hidden text container so browse-mode lands on the button exactly once.
36
+ * Override paths (componentOverrides.title/subtitle/textContainer or a
37
+ * consumer-supplied controlProps.ariaLabel) are preserved unchanged so
38
+ * customers who manage their own accessible names are not affected.
39
+ */
40
+
41
+ beforeAll(() => {
42
+ BroadcastServiceInitialize("testChannel");
43
+ });
44
+ afterEach(() => {
45
+ cleanup();
46
+ });
47
+ const isInsideAriaHidden = el => {
48
+ let cursor = el;
49
+ while (cursor) {
50
+ if (cursor.getAttribute("aria-hidden") === "true") return true;
51
+ cursor = cursor.parentElement;
52
+ }
53
+ return false;
54
+ };
55
+ const visibleTextElementsMatching = (root, text) => {
56
+ return Array.from(root.querySelectorAll("*")).filter(el => {
57
+ if (isInsideAriaHidden(el)) return false;
58
+ // Only count leaf-ish text-bearing elements (don't double-count
59
+ // ancestors whose textContent obviously aggregates children).
60
+ const ownText = Array.from(el.childNodes).filter(n => n.nodeType === Node.TEXT_NODE).map(n => (n.textContent || "").trim()).join(" ").trim();
61
+ return ownText === text;
62
+ });
63
+ };
64
+
65
+ /**
66
+ * Regression guard for internal tracking — ChatButton must not produce duplicate
67
+ * NVDA / JAWS browse-mode stops. Visible title / subtitle text is excluded
68
+ * from the accessibility tree (aria-hidden) and the button container owns a
69
+ * single consolidated aria-label.
70
+ */
71
+ describe("ChatButton — browse-mode duplicate stops (internal tracking)", () => {
72
+ it("title text 'Let's Chat!' must NOT appear as a visible (non-aria-hidden) name source in the chat-button subtree", () => {
73
+ const _render = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
74
+ container = _render.container;
75
+ const button = container.firstElementChild;
76
+ expect(button).not.toBeNull();
77
+ const titleStops = visibleTextElementsMatching(button, "Let's Chat!");
78
+ // The visible title should be excluded from the accessibility tree
79
+ // (e.g. via aria-hidden on the text container) so the announced name
80
+ // comes solely from the consolidated aria-label on the button. Any
81
+ // exposed text-bearing element with this exact text creates an
82
+ // additional browse-mode stop and reproduces internal tracking.
83
+ expect(titleStops.length).toBe(0);
84
+ });
85
+ it("subtitle text 'We're online.' must NOT appear as a visible (non-aria-hidden) name source in the chat-button subtree", () => {
86
+ const _render2 = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
87
+ container = _render2.container;
88
+ const button = container.firstElementChild;
89
+ expect(button).not.toBeNull();
90
+ const subtitleStops = visibleTextElementsMatching(button, "We're online.");
91
+ expect(subtitleStops.length).toBe(0);
92
+ });
93
+ it("the chat-button container must own a single consolidated aria-label so browse mode lands on it once", () => {
94
+ const _render3 = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
95
+ container = _render3.container;
96
+ const button = container.firstElementChild;
97
+ expect(button).not.toBeNull();
98
+ // Either the container has a non-empty aria-label, OR every inner
99
+ // text-bearing descendant is aria-hidden so the computed name comes
100
+ // from the inner text exactly once with no extra browse-mode stops.
101
+ const hasAriaLabel = !!(button.getAttribute("aria-label") || "").trim();
102
+ const innerVisibleText = visibleTextElementsMatching(button, "Let's Chat!").length + visibleTextElementsMatching(button, "We're online.").length;
103
+ // Today: hasAriaLabel === false (default ariaLabel is undefined) AND
104
+ // innerVisibleText > 0. The catcher requires at least one of these
105
+ // to flip.
106
+ expect(hasAriaLabel || innerVisibleText === 0).toBe(true);
107
+ });
108
+ it("the synthesized aria-label includes the unread-count fragment when hideNotificationBubble=false and unreadMessageCount > 0", () => {
109
+ const props = {
110
+ ...defaultChatButtonProps,
111
+ controlProps: {
112
+ ...defaultChatButtonProps.controlProps,
113
+ hideNotificationBubble: false,
114
+ unreadMessageCount: "3",
115
+ ariaLabelUnreadMessageString: "you have new messages",
116
+ titleText: "Let's Chat!",
117
+ subtitleText: "We're online."
118
+ }
119
+ };
120
+ const _render4 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
121
+ container = _render4.container;
122
+ const button = container.firstElementChild;
123
+ const ariaLabel = button.getAttribute("aria-label") || "";
124
+ expect(ariaLabel).toContain("3");
125
+ expect(ariaLabel).toContain("you have new messages");
126
+ expect(ariaLabel).toContain("Let's Chat!");
127
+ expect(ariaLabel).toContain("We're online.");
128
+ });
129
+ it("a consumer-supplied controlProps.ariaLabel wins over the synthesized label", () => {
130
+ const props = {
131
+ ...defaultChatButtonProps,
132
+ controlProps: {
133
+ ...defaultChatButtonProps.controlProps,
134
+ ariaLabel: "Talk to a live agent"
135
+ }
136
+ };
137
+ const _render5 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
138
+ container = _render5.container;
139
+ const button = container.firstElementChild;
140
+ expect(button.getAttribute("aria-label")).toBe("Talk to a live agent");
141
+ });
142
+ it("componentOverrides.textContainer preserves consumer-rendered visible text (synthesis is skipped)", () => {
143
+ const customText = "My custom chat text";
144
+ const props = {
145
+ ...defaultChatButtonProps,
146
+ componentOverrides: {
147
+ textContainer: /*#__PURE__*/React.createElement("div", {
148
+ id: "my-custom-text"
149
+ }, customText)
150
+ }
151
+ };
152
+ const _render6 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
153
+ container = _render6.container;
154
+ const button = container.firstElementChild;
155
+ // The custom text MUST remain visible in the a11y tree so consumers
156
+ // who replace the text container keep their announced text.
157
+ const customStops = visibleTextElementsMatching(button, customText);
158
+ expect(customStops.length).toBeGreaterThan(0);
159
+ // And the button must NOT carry a synthesized aria-label that would
160
+ // override the consumer's content.
161
+ const ariaLabel = (button.getAttribute("aria-label") || "").trim();
162
+ expect(ariaLabel).toBe("");
163
+ });
164
+ it("componentOverrides.title preserves consumer-rendered visible title (synthesis is skipped)", () => {
165
+ const customTitle = "Custom override title";
166
+ const props = {
167
+ ...defaultChatButtonProps,
168
+ componentOverrides: {
169
+ title: /*#__PURE__*/React.createElement("span", {
170
+ id: "my-custom-title"
171
+ }, customTitle)
172
+ }
173
+ };
174
+ const _render7 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
175
+ container = _render7.container;
176
+ const button = container.firstElementChild;
177
+ const customStops = visibleTextElementsMatching(button, customTitle);
178
+ expect(customStops.length).toBeGreaterThan(0);
179
+ const ariaLabel = (button.getAttribute("aria-label") || "").trim();
180
+ expect(ariaLabel).toBe("");
181
+ });
182
+
183
+ // Regression guard for the strict string-equality slip-throughs that
184
+ // brittle `unreadMessageCount !== "0"` allowed: values that coerce to
185
+ // numeric 0 (or non-numeric noise) must NOT render the bubble nor pollute
186
+ // the synthesized aria-label with a "0 you have new messages" fragment.
187
+ describe.each([["padded zero (' 0 ')", " 0 "], ["decimal zero ('0.0')", "0.0"], ["empty string ('')", ""], ["non-numeric ('abc')", "abc"]])("zero-equivalent unreadMessageCount: %s", (_label, value) => {
188
+ it("does NOT render the notification bubble", () => {
189
+ const props = {
190
+ ...defaultChatButtonProps,
191
+ controlProps: {
192
+ ...defaultChatButtonProps.controlProps,
193
+ hideNotificationBubble: false,
194
+ unreadMessageCount: value,
195
+ ariaLabelUnreadMessageString: "you have new messages"
196
+ }
197
+ };
198
+ const _render8 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
199
+ container = _render8.container;
200
+ const bubble = container.querySelector("[id$='-notification-bubble']");
201
+ expect(bubble).toBeNull();
202
+ });
203
+ it("does NOT inject the unread-count fragment into the synthesized aria-label", () => {
204
+ const props = {
205
+ ...defaultChatButtonProps,
206
+ controlProps: {
207
+ ...defaultChatButtonProps.controlProps,
208
+ hideNotificationBubble: false,
209
+ unreadMessageCount: value,
210
+ ariaLabelUnreadMessageString: "you have new messages"
211
+ }
212
+ };
213
+ const _render9 = render(/*#__PURE__*/React.createElement(ChatButton, props)),
214
+ container = _render9.container;
215
+ const button = container.firstElementChild;
216
+ const ariaLabel = button.getAttribute("aria-label") || "";
217
+ expect(ariaLabel).not.toContain("you have new messages");
218
+ // and the raw zero-equivalent must not leak into the label
219
+ if (value.trim().length > 0) {
220
+ expect(ariaLabel).not.toContain(value.trim());
221
+ }
222
+ });
223
+ });
224
+ });
@@ -0,0 +1,108 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import "@testing-library/jest-dom/extend-expect";
3
+ import { cleanup, render } from "@testing-library/react";
4
+ import { BroadcastServiceInitialize } from "../../services/BroadcastService";
5
+ import ChatButton from "./ChatButton";
6
+ import React from "react";
7
+ import { defaultChatButtonControlProps } from "./common/defaultProps/defaultChatButtonControlProps";
8
+ import { defaultChatButtonProps } from "./common/defaultProps/defaultChatButtonProps";
9
+ const expectedTitle = defaultChatButtonControlProps.titleText;
10
+ const expectedSubtitle = defaultChatButtonControlProps.subtitleText;
11
+
12
+ /**
13
+ * Repro / catcher for internal tracking — NVDA / JAWS in browse mode (virtual cursor)
14
+ * land on "Let's Chat, We're Online" multiple times when navigating with the
15
+ * down-arrow key.
16
+ *
17
+ * Root cause in code: `ChatButton` renders a Fluent UI `<Stack role="button">`
18
+ * with `tabIndex={0}` whose accessible name is computed from its visible
19
+ * children — a `<Label>` for the title (e.g. "Let's Chat!") and a `<Label>`
20
+ * for the subtitle (e.g. "We're online."). In browse mode, NVDA / JAWS treat
21
+ * the button itself AND each inner text node as separate virtual-cursor stops,
22
+ * each carrying the same announceable name fragments. There is no
23
+ * `aria-label` set by default, and the inner labels are not marked
24
+ * `aria-hidden="true"` (which is what would collapse them into a single
25
+ * announcement under the button container).
26
+ *
27
+ * Catcher contract: the title / subtitle strings must NOT appear as
28
+ * additional announceable name sources in the chat-button subtree (only the
29
+ * single consolidated aria-label on the role=button container should name the
30
+ * button). An "announceable name source" here is:
31
+ * - an `aria-label` attribute on a focusable / role-bearing element, OR
32
+ * - a visible `<Label>` (or other text-bearing element) that is NOT
33
+ * `aria-hidden="true"` and is not nested inside an element that is
34
+ * `aria-hidden="true"`.
35
+ *
36
+ * Expected to FAIL today: the rendered DOM contains BOTH the title text node
37
+ * AND the subtitle text node as bare visible text, and the parent Stack has
38
+ * no `aria-label` to consolidate them. Browse-mode therefore sees three
39
+ * stops (button, title, subtitle) all carrying the same combined name.
40
+ */
41
+
42
+ beforeAll(() => {
43
+ BroadcastServiceInitialize("testChannel");
44
+ });
45
+ afterEach(() => {
46
+ cleanup();
47
+ });
48
+ const isInsideAriaHidden = el => {
49
+ let cursor = el;
50
+ while (cursor) {
51
+ if (cursor.getAttribute("aria-hidden") === "true") return true;
52
+ cursor = cursor.parentElement;
53
+ }
54
+ return false;
55
+ };
56
+ const visibleTextElementsMatching = (root, text) => {
57
+ return Array.from(root.querySelectorAll("*")).filter(el => {
58
+ if (isInsideAriaHidden(el)) return false;
59
+ // Only count leaf-ish text-bearing elements (don't double-count
60
+ // ancestors whose textContent obviously aggregates children).
61
+ const ownText = Array.from(el.childNodes).filter(n => n.nodeType === Node.TEXT_NODE).map(n => (n.textContent || "").trim()).join(" ").trim();
62
+ return ownText === text;
63
+ });
64
+ };
65
+
66
+ /**
67
+ * SKIPPED until the source fix lands. Un-skip the describe below to validate
68
+ * the fix to internal tracking; the suite is expected to FAIL today against unfixed
69
+ * source. Mirrors the chat-widget `*.unfixed.a11y.spec.tsx` convention.
70
+ */
71
+ describe.skip("ChatButton — browse-mode duplicate stops (internal tracking)", () => {
72
+ it(`title text '${expectedTitle}' must NOT appear as a visible (non-aria-hidden) name source in the chat-button subtree`, () => {
73
+ const _render = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
74
+ container = _render.container;
75
+ const button = container.firstElementChild;
76
+ expect(button).not.toBeNull();
77
+ const titleStops = visibleTextElementsMatching(button, expectedTitle);
78
+ // The visible title should be excluded from the accessibility tree
79
+ // (e.g. via aria-hidden on the text container) so the announced name
80
+ // comes solely from the consolidated aria-label on the button. Any
81
+ // exposed text-bearing element with this exact text creates an
82
+ // additional browse-mode stop and reproduces internal tracking.
83
+ expect(titleStops.length).toBe(0);
84
+ });
85
+ it(`subtitle text '${expectedSubtitle}' must NOT appear as a visible (non-aria-hidden) name source in the chat-button subtree`, () => {
86
+ const _render2 = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
87
+ container = _render2.container;
88
+ const button = container.firstElementChild;
89
+ expect(button).not.toBeNull();
90
+ const subtitleStops = visibleTextElementsMatching(button, expectedSubtitle);
91
+ expect(subtitleStops.length).toBe(0);
92
+ });
93
+ it("the chat-button container must own a single consolidated aria-label so browse mode lands on it once", () => {
94
+ const _render3 = render(/*#__PURE__*/React.createElement(ChatButton, defaultChatButtonProps)),
95
+ container = _render3.container;
96
+ const button = container.firstElementChild;
97
+ expect(button).not.toBeNull();
98
+ // Either the container has a non-empty aria-label, OR every inner
99
+ // text-bearing descendant is aria-hidden so the computed name comes
100
+ // from the inner text exactly once with no extra browse-mode stops.
101
+ const hasAriaLabel = !!(button.getAttribute("aria-label") || "").trim();
102
+ const innerVisibleText = visibleTextElementsMatching(button, expectedTitle).length + visibleTextElementsMatching(button, expectedSubtitle).length;
103
+ // Today: hasAriaLabel === false (default ariaLabel is undefined) AND
104
+ // innerVisibleText > 0. The catcher requires at least one of these
105
+ // to flip.
106
+ expect(hasAriaLabel || innerVisibleText === 0).toBe(true);
107
+ });
108
+ });
@@ -10,13 +10,25 @@ import { defaultChatButtonNotificationBubbleStyles } from "./common/defaultStyle
10
10
  import { defaultChatButtonSubTitleStyles } from "./common/defaultStyles/defaultChatButtonSubTitleStyles";
11
11
  import { defaultChatButtonTextContainerStyles } from "./common/defaultStyles/defaultChatButtonTextContainerStyles";
12
12
  import { defaultChatButtonTitleStyles } from "./common/defaultStyles/defaultChatButtonTitleStyles";
13
+
14
+ // Returns true when the unread-message count represents a positive number.
15
+ // Defensive against non-strict callers that may pass " 0 ", "0.0", "" or a
16
+ // stringified numeric 0; only a finite count strictly greater than zero counts
17
+ // as "unread" for both the notification bubble and the synthesized aria-label.
18
+ function hasUnreadMessages(unreadMessageCount) {
19
+ if (unreadMessageCount === undefined || unreadMessageCount === null) {
20
+ return false;
21
+ }
22
+ const parsed = Number(unreadMessageCount);
23
+ return Number.isFinite(parsed) && parsed > 0;
24
+ }
13
25
  function NotificationBubble(props, parentId) {
14
26
  var _props$styleProps, _props$controlProps;
15
27
  const notificationBubbleStyles = {
16
28
  root: Object.assign({}, defaultChatButtonNotificationBubbleStyles, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.notificationBubbleStyleProps)
17
29
  };
18
30
  const unreadMessageCount = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.unreadMessageCount) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.unreadMessageCount);
19
- if (unreadMessageCount !== "0") {
31
+ if (hasUnreadMessages(unreadMessageCount)) {
20
32
  var _props$componentOverr, _props$controlProps2, _props$controlProps3, _props$styleProps2, _props$controlProps4, _props$controlProps5;
21
33
  return decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.notificationBubble) || /*#__PURE__*/React.createElement(Stack, {
22
34
  "aria-live": "polite",
@@ -42,7 +54,7 @@ function IconContainer(props, parentId) {
42
54
  });
43
55
  }
44
56
  function TextContainer(props, parentId) {
45
- var _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$controlProps9, _props$controlProps0, _props$controlProps1, _props$componentOverr3, _props$styleProps8, _props$componentOverr4, _props$styleProps9, _props$componentOverr5, _props$styleProps0;
57
+ var _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$controlProps9, _props$controlProps0, _props$controlProps1, _props$componentOverr3, _props$componentOverr4, _props$componentOverr5, _props$styleProps8, _props$componentOverr6, _props$styleProps9, _props$componentOverr7, _props$styleProps0;
46
58
  const textContainerStyles = {
47
59
  root: Object.assign({}, defaultChatButtonTextContainerStyles, (_props$styleProps5 = props.styleProps) === null || _props$styleProps5 === void 0 ? void 0 : _props$styleProps5.textContainerStyleProps)
48
60
  };
@@ -58,16 +70,26 @@ function TextContainer(props, parentId) {
58
70
  const titleText = ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.titleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.titleText);
59
71
  const subtitleDir = ((_props$controlProps0 = props.controlProps) === null || _props$controlProps0 === void 0 ? void 0 : _props$controlProps0.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
60
72
  const subtitleText = ((_props$controlProps1 = props.controlProps) === null || _props$controlProps1 === void 0 ? void 0 : _props$controlProps1.subtitleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.subtitleText);
61
- return decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.textContainer) || /*#__PURE__*/React.createElement(Stack, {
73
+
74
+ // internal tracking: when the default title / subtitle Labels are used, hide the
75
+ // text container subtree from the accessibility tree. The button container
76
+ // owns a consolidated aria-label that already announces the same text, so
77
+ // exposing the inner Labels causes NVDA / JAWS browse-mode to land on the
78
+ // same announcement multiple times. Customer overrides for title /
79
+ // subtitle keep their default a11y behavior so they can manage their own
80
+ // accessible names.
81
+ const hideTextFromA11yTree = !((_props$componentOverr3 = props.componentOverrides) !== null && _props$componentOverr3 !== void 0 && _props$componentOverr3.title) && !((_props$componentOverr4 = props.componentOverrides) !== null && _props$componentOverr4 !== void 0 && _props$componentOverr4.subtitle);
82
+ return decodeComponentString((_props$componentOverr5 = props.componentOverrides) === null || _props$componentOverr5 === void 0 ? void 0 : _props$componentOverr5.textContainer) || /*#__PURE__*/React.createElement(Stack, {
62
83
  styles: textContainerStyles,
63
84
  className: (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 || (_props$styleProps8 = _props$styleProps8.classNames) === null || _props$styleProps8 === void 0 ? void 0 : _props$styleProps8.textContainerClassName,
64
- id: parentId + "-text-container"
65
- }, !hideChatTitle && (decodeComponentString((_props$componentOverr4 = props.componentOverrides) === null || _props$componentOverr4 === void 0 ? void 0 : _props$componentOverr4.title) || /*#__PURE__*/React.createElement(Label, {
85
+ id: parentId + "-text-container",
86
+ "aria-hidden": hideTextFromA11yTree || undefined
87
+ }, !hideChatTitle && (decodeComponentString((_props$componentOverr6 = props.componentOverrides) === null || _props$componentOverr6 === void 0 ? void 0 : _props$componentOverr6.title) || /*#__PURE__*/React.createElement(Label, {
66
88
  styles: titleStyles,
67
89
  dir: titleDir,
68
90
  className: (_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 || (_props$styleProps9 = _props$styleProps9.classNames) === null || _props$styleProps9 === void 0 ? void 0 : _props$styleProps9.titleClassName,
69
91
  id: parentId + "-title"
70
- }, titleText)), !hideChatSubtitle && (decodeComponentString((_props$componentOverr5 = props.componentOverrides) === null || _props$componentOverr5 === void 0 ? void 0 : _props$componentOverr5.subtitle) || /*#__PURE__*/React.createElement(Label, {
92
+ }, titleText)), !hideChatSubtitle && (decodeComponentString((_props$componentOverr7 = props.componentOverrides) === null || _props$componentOverr7 === void 0 ? void 0 : _props$componentOverr7.subtitle) || /*#__PURE__*/React.createElement(Label, {
71
93
  styles: subtitleStyles,
72
94
  dir: subtitleDir,
73
95
  className: (_props$styleProps0 = props.styleProps) === null || _props$styleProps0 === void 0 || (_props$styleProps0 = _props$styleProps0.classNames) === null || _props$styleProps0 === void 0 ? void 0 : _props$styleProps0.subtitleClassName,
@@ -75,21 +97,36 @@ function TextContainer(props, parentId) {
75
97
  }, subtitleText)));
76
98
  }
77
99
  function ChatButton(props) {
78
- var _props$controlProps10, _props$controlProps11, _props$controlProps12, _props$controlProps13, _props$controlProps14, _props$controlProps15, _props$controlProps16, _props$controlProps17, _props$styleProps1;
100
+ var _props$controlProps10, _props$controlProps11, _props$controlProps12, _props$controlProps13, _props$controlProps14, _props$controlProps15, _props$controlProps16, _props$controlProps17, _props$controlProps18, _props$controlProps19, _props$controlProps20, _props$controlProps21, _props$controlProps22, _props$componentOverr8, _props$componentOverr9, _props$componentOverr0, _props$controlProps23, _props$styleProps1;
79
101
  const elementId = ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.id) ?? Ids.DefaultChatButtonId;
80
- const defaultAriaLabel = ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.ariaLabel) ?? defaultChatButtonControlProps.ariaLabel;
81
- const defaultRole = ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.role) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.role);
82
- const containersDir = ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
83
- const hideChatButton = ((_props$controlProps14 = props.controlProps) === null || _props$controlProps14 === void 0 ? void 0 : _props$controlProps14.hideChatButton) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatButton);
84
- const hideChatIcon = ((_props$controlProps15 = props.controlProps) === null || _props$controlProps15 === void 0 ? void 0 : _props$controlProps15.hideChatIcon) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatIcon);
85
- const hideChatTextContainer = ((_props$controlProps16 = props.controlProps) === null || _props$controlProps16 === void 0 ? void 0 : _props$controlProps16.hideChatTextContainer) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTextContainer);
86
- const hideNotificationBubble = ((_props$controlProps17 = props.controlProps) === null || _props$controlProps17 === void 0 ? void 0 : _props$controlProps17.hideNotificationBubble) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideNotificationBubble);
102
+ const defaultRole = ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.role) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.role);
103
+ const containersDir = ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
104
+ const hideChatButton = ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.hideChatButton) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatButton);
105
+ const hideChatIcon = ((_props$controlProps14 = props.controlProps) === null || _props$controlProps14 === void 0 ? void 0 : _props$controlProps14.hideChatIcon) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatIcon);
106
+ const hideChatTextContainer = ((_props$controlProps15 = props.controlProps) === null || _props$controlProps15 === void 0 ? void 0 : _props$controlProps15.hideChatTextContainer) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTextContainer);
107
+ const hideNotificationBubble = ((_props$controlProps16 = props.controlProps) === null || _props$controlProps16 === void 0 ? void 0 : _props$controlProps16.hideNotificationBubble) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideNotificationBubble);
108
+
109
+ // internal tracking: when the consumer has not supplied a custom aria-label and
110
+ // the default title / subtitle Labels are in play, synthesize a single
111
+ // consolidated aria-label from the visible text so NVDA / JAWS browse
112
+ // mode lands on the role=button container exactly once. The text
113
+ // container is also marked aria-hidden in TextContainer so the inner
114
+ // labels do not produce additional virtual-cursor stops.
115
+ const titleText = ((_props$controlProps17 = props.controlProps) === null || _props$controlProps17 === void 0 ? void 0 : _props$controlProps17.titleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.titleText);
116
+ const subtitleText = ((_props$controlProps18 = props.controlProps) === null || _props$controlProps18 === void 0 ? void 0 : _props$controlProps18.subtitleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.subtitleText);
117
+ const hideChatTitle = ((_props$controlProps19 = props.controlProps) === null || _props$controlProps19 === void 0 ? void 0 : _props$controlProps19.hideChatTitle) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTitle);
118
+ const hideChatSubtitle = ((_props$controlProps20 = props.controlProps) === null || _props$controlProps20 === void 0 ? void 0 : _props$controlProps20.hideChatSubtitle) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatSubtitle);
119
+ const unreadMessageCount = ((_props$controlProps21 = props.controlProps) === null || _props$controlProps21 === void 0 ? void 0 : _props$controlProps21.unreadMessageCount) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.unreadMessageCount);
120
+ const ariaLabelUnreadMessageString = ((_props$controlProps22 = props.controlProps) === null || _props$controlProps22 === void 0 ? void 0 : _props$controlProps22.ariaLabelUnreadMessageString) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.ariaLabelUnreadMessageString);
121
+ const canSynthesizeAriaLabel = !hideChatTextContainer && !((_props$componentOverr8 = props.componentOverrides) !== null && _props$componentOverr8 !== void 0 && _props$componentOverr8.textContainer) && !((_props$componentOverr9 = props.componentOverrides) !== null && _props$componentOverr9 !== void 0 && _props$componentOverr9.title) && !((_props$componentOverr0 = props.componentOverrides) !== null && _props$componentOverr0 !== void 0 && _props$componentOverr0.subtitle);
122
+ const synthesizedAriaLabel = canSynthesizeAriaLabel ? [!hideNotificationBubble && hasUnreadMessages(unreadMessageCount) ? `${unreadMessageCount} ${ariaLabelUnreadMessageString ?? ""}`.trim() : "", !hideChatTitle ? titleText : "", !hideChatSubtitle ? subtitleText : ""].filter(Boolean).join(" ").trim() : "";
123
+ const defaultAriaLabel = ((_props$controlProps23 = props.controlProps) === null || _props$controlProps23 === void 0 ? void 0 : _props$controlProps23.ariaLabel) ?? defaultChatButtonControlProps.ariaLabel ?? (synthesizedAriaLabel || undefined);
87
124
  const chatButtonGroupStyles = {
88
125
  root: Object.assign({}, defaultChatButtonGeneralStyles, (_props$styleProps1 = props.styleProps) === null || _props$styleProps1 === void 0 ? void 0 : _props$styleProps1.generalStyleProps)
89
126
  };
90
127
  const handleInitiateChatClick = useCallback(() => {
91
- var _props$controlProps18;
92
- if ((_props$controlProps18 = props.controlProps) !== null && _props$controlProps18 !== void 0 && _props$controlProps18.onClick) {
128
+ var _props$controlProps24;
129
+ if ((_props$controlProps24 = props.controlProps) !== null && _props$controlProps24 !== void 0 && _props$controlProps24.onClick) {
93
130
  const customEvent = {
94
131
  elementType: ElementType.ChatButton,
95
132
  elementId: elementId,
@@ -2,9 +2,7 @@ import React from "react";
2
2
  import { AriaLabels, ElementType, EventNames, IconNames, Texts } from "../../../common/Constants";
3
3
  import CommandButton from "../commandbutton/CommandButton";
4
4
  function CloseButton(props) {
5
- const {
6
- type
7
- } = props;
5
+ const type = props.type;
8
6
  const customEvent = {
9
7
  elementType: ElementType.CloseButton,
10
8
  elementId: props === null || props === void 0 ? void 0 : props.id,