@microsoft/omnichannel-chat-components 1.1.17-main.940d996 → 1.1.17-main.9b18f0e
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/lib/cjs/common/Constants.js +1 -1
- package/lib/cjs/components/chatbutton/ChatButton.blankAnnouncements.a11y.spec.js +162 -0
- package/lib/cjs/components/chatbutton/ChatButton.browseMode.unfixed.a11y.spec.js +115 -0
- package/lib/cjs/components/confirmationpane/ConfirmationPane.js +10 -8
- package/lib/cjs/components/confirmationpane/common/defaultProps/defaultConfirmationPaneControlProps.js +1 -0
- package/lib/cjs/components/inputvalidationpane/InputValidationPane.js +12 -10
- package/lib/cjs/components/inputvalidationpane/common/default/defaultProps/defaultInputValidationPaneControlProps.js +1 -0
- package/lib/cjs/components/prechatsurveypane/PreChatSurveyPane.js +45 -16
- package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultichoiceInputStyles.js +1 -0
- package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.js +1 -0
- package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.js +1 -0
- package/lib/esm/common/Constants.js +1 -1
- package/lib/esm/components/chatbutton/ChatButton.blankAnnouncements.a11y.spec.js +159 -0
- package/lib/esm/components/chatbutton/ChatButton.browseMode.unfixed.a11y.spec.js +111 -0
- package/lib/esm/components/confirmationpane/ConfirmationPane.js +10 -8
- package/lib/esm/components/confirmationpane/common/defaultProps/defaultConfirmationPaneControlProps.js +1 -0
- package/lib/esm/components/inputvalidationpane/InputValidationPane.js +12 -10
- package/lib/esm/components/inputvalidationpane/common/default/defaultProps/defaultInputValidationPaneControlProps.js +1 -0
- package/lib/esm/components/prechatsurveypane/PreChatSurveyPane.js +45 -16
- package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultichoiceInputStyles.js +1 -0
- package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.js +1 -0
- package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.js +1 -0
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/components/chatbutton/ChatButton.blankAnnouncements.a11y.spec.d.ts +1 -0
- package/lib/types/components/chatbutton/ChatButton.browseMode.unfixed.a11y.spec.d.ts +1 -0
- package/lib/types/components/confirmationpane/interfaces/IConfirmationPaneControlProps.d.ts +1 -0
- package/lib/types/components/inputvalidationpane/interfaces/IInputValidationPaneControlProps.d.ts +1 -0
- package/package.json +19 -1
|
@@ -47,6 +47,6 @@ let ElementType = exports.ElementType = /*#__PURE__*/function (ElementType) {
|
|
|
47
47
|
const Ids = exports.Ids = (_Class3 = class Ids {}, _Class3.DefaultCallingContainerId = "lcw-calling-container", _Class3.DefaultCurrentCallId = "lcw-current-call-container", _Class3.CurrentCallActionGroupId = "lcw-current-call-action-icons", _Class3.CurrentCallFooterId = "lcw-current-call-footer", _Class3.RemoteVideoTileId = "lcw-remote-video", _Class3.SelfVideoTileId = "lcw-self-video", _Class3.VideoTileGroupId = "lcw-current-call-body", _Class3.EndCallButtonId = "lcw-call-reject-button", _Class3.MicButtonId = "lcw-toggle-audio", _Class3.VideoButtonId = "lcw-toggle-video", _Class3.CallTimerId = "lcw-current-call-timer", _Class3.CurrentCallLeftGroupId = "lcw-current-call-left-group", _Class3.CurrentCallMiddleGroupId = "lcw-current-call-middle-group", _Class3.CurrentCallRightGroupId = "lcw-current-call-right-group", _Class3.DefaultIncomingCallId = "lcw-incoming-call", _Class3.DeclineCallButtonId = "lcw-call-reject-button", _Class3.AudioCallButtonId = "lcw-call-accept-button", _Class3.VideoCallButtonId = "lcw-video-call-accept-button", _Class3.IncomingCallTitleId = "lcw-incoming-call-message", _Class3.DefaultIncomingCallPopupId = "lcw-incoming-call-popup", _Class3.IncomingCallLeftGroupId = "lcw-incoming-call-left-group", _Class3.IncomingCallMiddleGroupId = "lcw-incoming-call-middle-group", _Class3.IncomingCallRightGroupId = "lcw-incoming-call-right-group", _Class3.DefaultChatButtonId = "lcw-components-chat-button", _Class3.DefaultConfirmationPaneId = "lcw-components-confirmation-pane", _Class3.CustomFooterId = "lcw-footer", _Class3.DownloadTranscriptButtonId = "lcw-footer-download-transcript-button", _Class3.EmailTranscriptButtonId = "lcw-footer-email-transcript-button", _Class3.AudioNotificationButtonId = "lcw-footer-audio-notification-button", _Class3.DefaultFooterId = "lcw-components-footer", _Class3.FooterLeftGroupId = "lcw-footer-left-group", _Class3.FooterMiddleGroupId = "lcw-footer-middle-group", _Class3.FooterRightGroupId = "lcw-footer-right-group", _Class3.DefaultHeaderId = "lcw-header", _Class3.MinimizeButtonId = "lcw-header-minimize-button", _Class3.CloseButtonId = "lcw-header-close-button", _Class3.HeaderIconId = "lcw-header-icon", _Class3.HeaderTitleId = "lcw-header-title", _Class3.HeaderLeftGroupId = "lcw-header-left-group", _Class3.HeaderMiddleGroupId = "lcw-header-middle-group", _Class3.HeaderRightGroupId = "lcw-header-right-group", _Class3.DefaultInputValidationPaneId = "lcw-email-transcript-dialog-container", _Class3.DefaultInputValidationPaneInputId = "lcw-email-transcript-dialog-text-field", _Class3.DefaultLoadingPaneId = "lcw-loading-pane", _Class3.DefaultNotificationPaneId = "lcw-notification-pane", _Class3.DefaultOOOHPaneId = "lcw-out-of-office-hours-pane", _Class3.DefaultPostChatSurveyPaneId = "lcw-postchat-survey-pane", _Class3.DefaultPreChatSurveyPaneId = "lcw-prechat-survey-pane-default", _Class3.DefaultProactiveChatPaneId = "lcw-proactive-chat", _Class3.DefaultReconnectChatPaneId = "lcw-reconnect-chat-pane", _Class3);
|
|
48
48
|
const ButtonTypes = exports.ButtonTypes = (_Class4 = class ButtonTypes {}, _Class4.Icon = "icon", _Class4.Text = "text", _Class4);
|
|
49
49
|
const IconNames = exports.IconNames = (_Class5 = class IconNames {}, _Class5.DeclineCall = "DeclineCall", _Class5.Microphone = "Microphone", _Class5.MicOff2 = "MicOff2", _Class5.Video = "Video", _Class5.VideoOff = "VideoOff", _Class5.IncomingCall = "IncomingCall", _Class5.ChromeClose = "ChromeClose", _Class5.Download = "Download", _Class5.Mail = "Mail", _Class5.Volume3 = "Volume3", _Class5.Volume0 = "Volume0", _Class5.ChromeMinimize = "ChromeMinimize", _Class5);
|
|
50
|
-
const AriaLabels = exports.AriaLabels = (_Class6 = class AriaLabels {}, _Class6.EndCall = "End Call", _Class6.MicMute = "Mute", _Class6.MicUnmute = "Unmute", _Class6.VideoTurnCameraOn = "Turn camera on", _Class6.VideoTurnCameraOff = "Turn camera off", _Class6.IncomingCallArea = "Incoming call area", _Class6.RejectCall = "Reject call", _Class6.AcceptVoiceCall = "Accept voice call", _Class6.AcceptVideoCall = "Accept video Call", _Class6.DeclineCall = "Decline Call", _Class6.AudioCall = "Audio Call", _Class6.VideoCall = "Video Call", _Class6.LetsChatWeAreOnline = "Let's chat we are online", _Class6.UnreadMessageString = "you have new messages", _Class6.Close = "Close", _Class6.ConfirmationPaneConfirm = "Close Chat", _Class6.ConfirmationPaneCancel = "Cancel. Return to Chat", _Class6.DownloadChatTranscript = "Download chat transcript", _Class6.EmailTranscript = "Email Transcript", _Class6.TurnSoundOff = "Turn sound off", _Class6.TurnSoundOn = "Turn sound on", _Class6.Minimize = "Minimize", _Class6.EmailChatTranscriptPane = "Email Chat Transcript Pane", _Class6.InputValidationPaneInput = "Please provide e-mail address to send transcript. The transcript will be sent after the chat ends. Email address text area", _Class6.Save = "Save", _Class6.Cancel = "Cancel", _Class6.ProactiveChatPane = "Proactive Chat Pane", _Class6.ChatNow = "Chat Now", _Class6.ReconnectChatPane = "Reconnect Chat Pane", _Class6.ReconnectChatPaneIcon = "Reconnect Chat Pane Icon", _Class6.ContinueConversation = "Continue conversation", _Class6.StartNewConversation = "Start new conversation", _Class6);
|
|
50
|
+
const AriaLabels = exports.AriaLabels = (_Class6 = class AriaLabels {}, _Class6.EndCall = "End Call", _Class6.MicMute = "Mute", _Class6.MicUnmute = "Unmute", _Class6.VideoTurnCameraOn = "Turn camera on", _Class6.VideoTurnCameraOff = "Turn camera off", _Class6.IncomingCallArea = "Incoming call area", _Class6.RejectCall = "Reject call", _Class6.AcceptVoiceCall = "Accept voice call", _Class6.AcceptVideoCall = "Accept video Call", _Class6.DeclineCall = "Decline Call", _Class6.AudioCall = "Audio Call", _Class6.VideoCall = "Video Call", _Class6.LetsChatWeAreOnline = "Let's chat we are online", _Class6.UnreadMessageString = "you have new messages", _Class6.Close = "Close", _Class6.ConfirmationPaneConfirm = "Close Chat", _Class6.ConfirmationPaneCancel = "Cancel. Return to Chat", _Class6.DownloadChatTranscript = "Download chat transcript", _Class6.EmailTranscript = "Email Transcript", _Class6.TurnSoundOff = "Turn sound off", _Class6.TurnSoundOn = "Turn sound on", _Class6.Minimize = "Minimize", _Class6.EmailChatTranscriptPane = "Email Chat Transcript Pane", _Class6.InputValidationPaneInput = "Please provide e-mail address to send transcript. The transcript will be sent after the chat ends. Email address text area", _Class6.Save = "Save", _Class6.Cancel = "Cancel", _Class6.ProactiveChatPane = "Proactive Chat Pane", _Class6.ChatNow = "Chat Now", _Class6.ReconnectChatPane = "Reconnect Chat Pane", _Class6.ReconnectChatPaneIcon = "Reconnect Chat Pane Icon", _Class6.ContinueConversation = "Continue conversation", _Class6.StartNewConversation = "Start new conversation", _Class6.InputValidationPaneButtonGroup = "Actions", _Class6.ConfirmationPaneButtonGroup = "Actions", _Class6);
|
|
51
51
|
const EventNames = exports.EventNames = (_Class7 = class EventNames {}, _Class7.OnClick = "OnClick", _Class7.OnEscapeKeyDown = "OnEscapeKeyDown", _Class7.IncomingCallEnded = "IncomingCallEnded", _Class7);
|
|
52
52
|
const Texts = exports.Texts = (_Class8 = class Texts {}, _Class8.IncomingCallTitle = "Incoming Call", _Class8.ChatButtonTitle = "Let's Chat!", _Class8.ChatButtonSubtitle = "We're online.", _Class8.ChatButtonUnreadMessageString = "new messages", _Class8.ChatButtonLargeUnreadMessageString = "99+", _Class8.CloseButtonText = "Close", _Class8.ConfirmationPaneTitle = "Close chat", _Class8.ConfirmationPaneSubtitle = "Do you really want to close this chat?", _Class8.ConfirmButtonText = "Close", _Class8.EmailPlaceHolderText = "johnsmith@outlook.com", _Class8.CancelButtonText = "Cancel", _Class8.DownloadChatTranscriptText = "Download chat transcript", _Class8.EmailTranscriptText = "Email Transcript", _Class8.HeaderIcon = "Chat Icon", _Class8.HeaderTitle = "Let's Chat", _Class8.MinimizeText = "Minimize", _Class8.InputValidationPaneTitleText = "Please provide e-mail address to send transcript.", _Class8.InputValidationPaneSubtitleText = "The transcript will be sent after the chat ends.", _Class8.InvalidInputErrorMessageText = "Enter a valid email address.", _Class8.SendButtonText = "Send", _Class8.SaveButtonText = "Save", _Class8.LoadingPaneTitleText = "Welcome to", _Class8.LoadingPaneSubtitleText = "live chat support ...", _Class8.LoadingPaneSpinnerText = "Loading ...", _Class8.OOOHPaneTitleText = "Thanks for contacting us. You have reached us outside of our operating hours. An agent will respond when we open.", _Class8.PostChatSurveyPaneTitleText = "Post chat survey pane", _Class8.ProactiveChatPaneTitleText = "Welcome to", _Class8.ProactiveChatPaneSubtitleText = "Live chat support!", _Class8.ProactiveChatPaneBodyTitleText = "Hi! Have any questions? I am here to help.", _Class8.ProactiveChatPaneStartButtonText = "Chat Now", _Class8.ReconnectChatPaneTitleText = "Previous session detected", _Class8.ReconnectChatPaneSubtitleText = "We have detected a previous chat session. Would you like to continue with your previous session?", _Class8.ReconnectChatPaneContinueChatButtonText = "Continue conversation", _Class8.ReconnectChatPaneStartNewChatButtonText = "Start new conversation", _Class8);
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("@testing-library/jest-dom/extend-expect");
|
|
4
|
+
var _react = require("@testing-library/react");
|
|
5
|
+
var _BroadcastService = require("../../services/BroadcastService");
|
|
6
|
+
var _ChatButton = _interopRequireDefault(require("./ChatButton"));
|
|
7
|
+
var _LoadingPane = _interopRequireDefault(require("../loadingpane/LoadingPane"));
|
|
8
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
9
|
+
var _defaultChatButtonProps = require("./common/defaultProps/defaultChatButtonProps");
|
|
10
|
+
var _defaultLoadingPaneProps = require("../loadingpane/common/defaultProps/defaultLoadingPaneProps");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Repro / catcher for internal tracking — screen reader announces hidden / irrelevant
|
|
16
|
+
* text such as "blank" while navigating the chat surface. NVDA / JAWS announce
|
|
17
|
+
* "blank" when they encounter:
|
|
18
|
+
* - an element with an announceable role (button, link, textbox, listitem,
|
|
19
|
+
* progressbar, etc.) that has an empty accessible name (no aria-label, no
|
|
20
|
+
* aria-labelledby, no associated <label>, and no own text content), OR
|
|
21
|
+
* - a live region (`aria-live="polite"` / `aria-live="assertive"`) that is
|
|
22
|
+
* mounted with empty text content (each tick announces "blank").
|
|
23
|
+
*
|
|
24
|
+
* This catcher walks several rendered LCW surfaces and asserts neither pattern
|
|
25
|
+
* is present. Deterministic DOM contract — no SR needed.
|
|
26
|
+
*
|
|
27
|
+
* Surfaces covered today:
|
|
28
|
+
* - ChatButton (default props) — regression guard; passes today.
|
|
29
|
+
* - ChatButton with notification bubble forced visible at unreadCount=0 —
|
|
30
|
+
* regression guard for the empty-live-region path; passes today.
|
|
31
|
+
* - LoadingPane (default props) — regression guard; passes today.
|
|
32
|
+
*
|
|
33
|
+
* Scope note: the original bug surfaces inside WebChat-rendered chat session
|
|
34
|
+
* content (message bubbles, attachments, agent-supplied HTML), which is not
|
|
35
|
+
* reachable from chat-components unit tests. The Playwright catcher
|
|
36
|
+
* `automation_tests/e2e/areas/accessibility/blankAnnouncements.spec.ts` on
|
|
37
|
+
* `chore/a11y-tooling-foundation` walks the full a11y tree of a built
|
|
38
|
+
* `dist/out.js` and is the right vehicle for enumerating per-offender fixes.
|
|
39
|
+
* Promote additional surfaces here as they are wired into the catcher harness.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
beforeAll(() => {
|
|
43
|
+
(0, _BroadcastService.BroadcastServiceInitialize)("testChannel");
|
|
44
|
+
});
|
|
45
|
+
afterEach(() => {
|
|
46
|
+
(0, _react.cleanup)();
|
|
47
|
+
});
|
|
48
|
+
const ANNOUNCEABLE_ROLES = new Set(["button", "link", "textbox", "combobox", "listbox", "listitem", "menu", "menuitem", "checkbox", "radio", "switch", "tab", "treeitem", "option", "searchbox", "progressbar", "alert", "status"]);
|
|
49
|
+
const ANNOUNCEABLE_TAGS = new Set(["button", "a", "input", "select", "textarea"]);
|
|
50
|
+
const isInsideAriaHidden = el => {
|
|
51
|
+
let cursor = el;
|
|
52
|
+
while (cursor) {
|
|
53
|
+
if (cursor.getAttribute("aria-hidden") === "true") return true;
|
|
54
|
+
cursor = cursor.parentElement;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
};
|
|
58
|
+
const accessibleNameOf = el => {
|
|
59
|
+
const ariaLabel = (el.getAttribute("aria-label") || "").trim();
|
|
60
|
+
if (ariaLabel) return ariaLabel;
|
|
61
|
+
const labelledBy = (el.getAttribute("aria-labelledby") || "").trim();
|
|
62
|
+
if (labelledBy) {
|
|
63
|
+
const referenced = labelledBy.split(/\s+/).map(id => {
|
|
64
|
+
var _document$getElementB;
|
|
65
|
+
return ((_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.textContent) || "";
|
|
66
|
+
}).join(" ").trim();
|
|
67
|
+
if (referenced) return referenced;
|
|
68
|
+
}
|
|
69
|
+
if (el.tagName.toLowerCase() === "input") {
|
|
70
|
+
const id = el.id;
|
|
71
|
+
if (id) {
|
|
72
|
+
var _label$textContent;
|
|
73
|
+
const label = document.querySelector(`label[for="${CSS.escape(id)}"]`);
|
|
74
|
+
const labelText = label === null || label === void 0 || (_label$textContent = label.textContent) === null || _label$textContent === void 0 ? void 0 : _label$textContent.trim();
|
|
75
|
+
if (labelText) return labelText;
|
|
76
|
+
}
|
|
77
|
+
const placeholder = (el.getAttribute("placeholder") || "").trim();
|
|
78
|
+
if (placeholder) return placeholder;
|
|
79
|
+
}
|
|
80
|
+
if (el.tagName.toLowerCase() === "a") {
|
|
81
|
+
const title = (el.getAttribute("title") || "").trim();
|
|
82
|
+
if (title) return title;
|
|
83
|
+
}
|
|
84
|
+
return (el.textContent || "").trim();
|
|
85
|
+
};
|
|
86
|
+
const isAnnounceable = el => {
|
|
87
|
+
if (isInsideAriaHidden(el)) return false;
|
|
88
|
+
const role = (el.getAttribute("role") || "").toLowerCase();
|
|
89
|
+
if (role === "presentation" || role === "none") return false;
|
|
90
|
+
if (role && ANNOUNCEABLE_ROLES.has(role)) return true;
|
|
91
|
+
if (ANNOUNCEABLE_TAGS.has(el.tagName.toLowerCase())) {
|
|
92
|
+
// <input type="hidden"> is not announceable.
|
|
93
|
+
if (el.tagName.toLowerCase() === "input" && (el.getAttribute("type") || "").toLowerCase() === "hidden") {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
};
|
|
100
|
+
const findEmptyAnnounceable = root => {
|
|
101
|
+
return Array.from(root.querySelectorAll("*")).filter(el => isAnnounceable(el) && accessibleNameOf(el) === "");
|
|
102
|
+
};
|
|
103
|
+
const findEmptyLiveRegions = root => {
|
|
104
|
+
return Array.from(root.querySelectorAll("[aria-live]")).filter(el => {
|
|
105
|
+
if (isInsideAriaHidden(el)) return false;
|
|
106
|
+
const live = (el.getAttribute("aria-live") || "").toLowerCase();
|
|
107
|
+
if (live !== "polite" && live !== "assertive") return false;
|
|
108
|
+
return (el.textContent || "").trim() === "";
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const summarize = offenders => offenders.map(el => ({
|
|
112
|
+
tag: el.tagName.toLowerCase(),
|
|
113
|
+
id: el.id,
|
|
114
|
+
role: el.getAttribute("role"),
|
|
115
|
+
ariaLabel: el.getAttribute("aria-label"),
|
|
116
|
+
ariaLabelledBy: el.getAttribute("aria-labelledby"),
|
|
117
|
+
classes: el.className
|
|
118
|
+
}));
|
|
119
|
+
describe("ChatButton — 'blank' / empty-name announcements (internal tracking regression guard)", () => {
|
|
120
|
+
it("no announceable role/tag in the chat-button subtree may have an empty accessible name", () => {
|
|
121
|
+
const {
|
|
122
|
+
container
|
|
123
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_ChatButton.default, _defaultChatButtonProps.defaultChatButtonProps));
|
|
124
|
+
const button = container.firstElementChild;
|
|
125
|
+
expect(button).not.toBeNull();
|
|
126
|
+
expect(summarize(findEmptyAnnounceable(button))).toEqual([]);
|
|
127
|
+
});
|
|
128
|
+
it("no live region (aria-live=polite/assertive) in the chat-button subtree may be mounted with empty text", () => {
|
|
129
|
+
const props = {
|
|
130
|
+
..._defaultChatButtonProps.defaultChatButtonProps,
|
|
131
|
+
controlProps: {
|
|
132
|
+
..._defaultChatButtonProps.defaultChatButtonProps.controlProps,
|
|
133
|
+
unreadMessageCount: "0",
|
|
134
|
+
hideNotificationBubble: false
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const {
|
|
138
|
+
container
|
|
139
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_ChatButton.default, props));
|
|
140
|
+
const button = container.firstElementChild;
|
|
141
|
+
expect(button).not.toBeNull();
|
|
142
|
+
expect(summarize(findEmptyLiveRegions(button))).toEqual([]);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
describe("LoadingPane — 'blank' / empty-name announcements (internal tracking regression guard)", () => {
|
|
146
|
+
it("no announceable role/tag in the loading-pane subtree may have an empty accessible name", () => {
|
|
147
|
+
const {
|
|
148
|
+
container
|
|
149
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_LoadingPane.default, _defaultLoadingPaneProps.defaultLoadingPaneProps));
|
|
150
|
+
const pane = container.firstElementChild;
|
|
151
|
+
expect(pane).not.toBeNull();
|
|
152
|
+
expect(summarize(findEmptyAnnounceable(pane))).toEqual([]);
|
|
153
|
+
});
|
|
154
|
+
it("no live region (aria-live=polite/assertive) in the loading-pane subtree may be mounted with empty text", () => {
|
|
155
|
+
const {
|
|
156
|
+
container
|
|
157
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_LoadingPane.default, _defaultLoadingPaneProps.defaultLoadingPaneProps));
|
|
158
|
+
const pane = container.firstElementChild;
|
|
159
|
+
expect(pane).not.toBeNull();
|
|
160
|
+
expect(summarize(findEmptyLiveRegions(pane))).toEqual([]);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("@testing-library/jest-dom/extend-expect");
|
|
4
|
+
var _react = require("@testing-library/react");
|
|
5
|
+
var _BroadcastService = require("../../services/BroadcastService");
|
|
6
|
+
var _ChatButton = _interopRequireDefault(require("./ChatButton"));
|
|
7
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
8
|
+
var _defaultChatButtonControlProps = require("./common/defaultProps/defaultChatButtonControlProps");
|
|
9
|
+
var _defaultChatButtonProps = require("./common/defaultProps/defaultChatButtonProps");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
|
+
|
|
13
|
+
const expectedTitle = _defaultChatButtonControlProps.defaultChatButtonControlProps.titleText;
|
|
14
|
+
const expectedSubtitle = _defaultChatButtonControlProps.defaultChatButtonControlProps.subtitleText;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Repro / catcher for internal tracking — NVDA / JAWS in browse mode (virtual cursor)
|
|
18
|
+
* land on "Let's Chat, We're Online" multiple times when navigating with the
|
|
19
|
+
* down-arrow key.
|
|
20
|
+
*
|
|
21
|
+
* Root cause in code: `ChatButton` renders a Fluent UI `<Stack role="button">`
|
|
22
|
+
* with `tabIndex={0}` whose accessible name is computed from its visible
|
|
23
|
+
* children — a `<Label>` for the title (e.g. "Let's Chat!") and a `<Label>`
|
|
24
|
+
* for the subtitle (e.g. "We're online."). In browse mode, NVDA / JAWS treat
|
|
25
|
+
* the button itself AND each inner text node as separate virtual-cursor stops,
|
|
26
|
+
* each carrying the same announceable name fragments. There is no
|
|
27
|
+
* `aria-label` set by default, and the inner labels are not marked
|
|
28
|
+
* `aria-hidden="true"` (which is what would collapse them into a single
|
|
29
|
+
* announcement under the button container).
|
|
30
|
+
*
|
|
31
|
+
* Catcher contract: the title / subtitle strings must NOT appear as
|
|
32
|
+
* additional announceable name sources in the chat-button subtree (only the
|
|
33
|
+
* single consolidated aria-label on the role=button container should name the
|
|
34
|
+
* button). An "announceable name source" here is:
|
|
35
|
+
* - an `aria-label` attribute on a focusable / role-bearing element, OR
|
|
36
|
+
* - a visible `<Label>` (or other text-bearing element) that is NOT
|
|
37
|
+
* `aria-hidden="true"` and is not nested inside an element that is
|
|
38
|
+
* `aria-hidden="true"`.
|
|
39
|
+
*
|
|
40
|
+
* Expected to FAIL today: the rendered DOM contains BOTH the title text node
|
|
41
|
+
* AND the subtitle text node as bare visible text, and the parent Stack has
|
|
42
|
+
* no `aria-label` to consolidate them. Browse-mode therefore sees three
|
|
43
|
+
* stops (button, title, subtitle) all carrying the same combined name.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
beforeAll(() => {
|
|
47
|
+
(0, _BroadcastService.BroadcastServiceInitialize)("testChannel");
|
|
48
|
+
});
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
(0, _react.cleanup)();
|
|
51
|
+
});
|
|
52
|
+
const isInsideAriaHidden = el => {
|
|
53
|
+
let cursor = el;
|
|
54
|
+
while (cursor) {
|
|
55
|
+
if (cursor.getAttribute("aria-hidden") === "true") return true;
|
|
56
|
+
cursor = cursor.parentElement;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
};
|
|
60
|
+
const visibleTextElementsMatching = (root, text) => {
|
|
61
|
+
return Array.from(root.querySelectorAll("*")).filter(el => {
|
|
62
|
+
if (isInsideAriaHidden(el)) return false;
|
|
63
|
+
// Only count leaf-ish text-bearing elements (don't double-count
|
|
64
|
+
// ancestors whose textContent obviously aggregates children).
|
|
65
|
+
const ownText = Array.from(el.childNodes).filter(n => n.nodeType === Node.TEXT_NODE).map(n => (n.textContent || "").trim()).join(" ").trim();
|
|
66
|
+
return ownText === text;
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* SKIPPED until the source fix lands. Un-skip the describe below to validate
|
|
72
|
+
* the fix to internal tracking; the suite is expected to FAIL today against unfixed
|
|
73
|
+
* source. Mirrors the chat-widget `*.unfixed.a11y.spec.tsx` convention.
|
|
74
|
+
*/
|
|
75
|
+
describe.skip("ChatButton — browse-mode duplicate stops (internal tracking)", () => {
|
|
76
|
+
it(`title text '${expectedTitle}' must NOT appear as a visible (non-aria-hidden) name source in the chat-button subtree`, () => {
|
|
77
|
+
const {
|
|
78
|
+
container
|
|
79
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_ChatButton.default, _defaultChatButtonProps.defaultChatButtonProps));
|
|
80
|
+
const button = container.firstElementChild;
|
|
81
|
+
expect(button).not.toBeNull();
|
|
82
|
+
const titleStops = visibleTextElementsMatching(button, expectedTitle);
|
|
83
|
+
// The visible title should be excluded from the accessibility tree
|
|
84
|
+
// (e.g. via aria-hidden on the text container) so the announced name
|
|
85
|
+
// comes solely from the consolidated aria-label on the button. Any
|
|
86
|
+
// exposed text-bearing element with this exact text creates an
|
|
87
|
+
// additional browse-mode stop and reproduces internal tracking.
|
|
88
|
+
expect(titleStops.length).toBe(0);
|
|
89
|
+
});
|
|
90
|
+
it(`subtitle text '${expectedSubtitle}' must NOT appear as a visible (non-aria-hidden) name source in the chat-button subtree`, () => {
|
|
91
|
+
const {
|
|
92
|
+
container
|
|
93
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_ChatButton.default, _defaultChatButtonProps.defaultChatButtonProps));
|
|
94
|
+
const button = container.firstElementChild;
|
|
95
|
+
expect(button).not.toBeNull();
|
|
96
|
+
const subtitleStops = visibleTextElementsMatching(button, expectedSubtitle);
|
|
97
|
+
expect(subtitleStops.length).toBe(0);
|
|
98
|
+
});
|
|
99
|
+
it("the chat-button container must own a single consolidated aria-label so browse mode lands on it once", () => {
|
|
100
|
+
const {
|
|
101
|
+
container
|
|
102
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_ChatButton.default, _defaultChatButtonProps.defaultChatButtonProps));
|
|
103
|
+
const button = container.firstElementChild;
|
|
104
|
+
expect(button).not.toBeNull();
|
|
105
|
+
// Either the container has a non-empty aria-label, OR every inner
|
|
106
|
+
// text-bearing descendant is aria-hidden so the computed name comes
|
|
107
|
+
// from the inner text exactly once with no extra browse-mode stops.
|
|
108
|
+
const hasAriaLabel = !!(button.getAttribute("aria-label") || "").trim();
|
|
109
|
+
const innerVisibleText = visibleTextElementsMatching(button, expectedTitle).length + visibleTextElementsMatching(button, expectedSubtitle).length;
|
|
110
|
+
// Today: hasAriaLabel === false (default ariaLabel is undefined) AND
|
|
111
|
+
// innerVisibleText > 0. The catcher requires at least one of these
|
|
112
|
+
// to flip.
|
|
113
|
+
expect(hasAriaLabel || innerVisibleText === 0).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -23,7 +23,7 @@ var _defaultConfirmationPaneConfirmButtonFocusedStyles = require("./common/defau
|
|
|
23
23
|
var _defaultConfirmationPaneCancelButtonFocusedStyles = require("./common/defaultStyles/defaultConfirmationPaneCancelButtonFocusedStyles");
|
|
24
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
25
25
|
function ConfirmationPane(props) {
|
|
26
|
-
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps0, _props$styleProps1, _props$styleProps10, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$componentOverr, _props$styleProps11, _props$controlProps9, _props$controlProps0, _props$componentOverr2, _props$styleProps12, _props$controlProps1, _props$styleProps13, _props$controlProps10, _props$
|
|
26
|
+
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps0, _props$styleProps1, _props$styleProps10, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$componentOverr, _props$styleProps11, _props$controlProps9, _props$controlProps0, _props$componentOverr2, _props$styleProps12, _props$controlProps1, _props$styleProps13, _props$controlProps10, _props$controlProps11, _props$componentOverr3, _props$styleProps14, _props$controlProps12, _props$controlProps13, _props$controlProps14, _props$componentOverr4, _props$styleProps15, _props$controlProps15, _props$controlProps16;
|
|
27
27
|
const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? _defaultConfirmationPaneControlProps.defaultConfirmationPaneControlProps.id;
|
|
28
28
|
const handleConfirmClick = (0, _react2.useCallback)(() => {
|
|
29
29
|
var _props$controlProps2;
|
|
@@ -105,21 +105,23 @@ function ConfirmationPane(props) {
|
|
|
105
105
|
horizontal: true,
|
|
106
106
|
className: (_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 || (_props$styleProps13 = _props$styleProps13.classNames) === null || _props$styleProps13 === void 0 ? void 0 : _props$styleProps13.buttonGroupClassName,
|
|
107
107
|
styles: buttonGroupStyles,
|
|
108
|
-
id: elementId + "-buttongroup"
|
|
109
|
-
|
|
108
|
+
id: elementId + "-buttongroup",
|
|
109
|
+
role: "group",
|
|
110
|
+
"aria-label": ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.buttonGroupAriaLabel) || _defaultConfirmationPaneControlProps.defaultConfirmationPaneControlProps.buttonGroupAriaLabel
|
|
111
|
+
}, !((_props$controlProps11 = props.controlProps) !== null && _props$controlProps11 !== void 0 && _props$controlProps11.hideConfirmButton) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.confirmButton) || /*#__PURE__*/_react2.default.createElement(_Button.PrimaryButton, {
|
|
110
112
|
className: (_props$styleProps14 = props.styleProps) === null || _props$styleProps14 === void 0 || (_props$styleProps14 = _props$styleProps14.classNames) === null || _props$styleProps14 === void 0 ? void 0 : _props$styleProps14.confirmButtonClassName,
|
|
111
113
|
styles: confirmButtonStyles,
|
|
112
|
-
text: ((_props$
|
|
114
|
+
text: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.confirmButtonText) || _defaultConfirmationPaneControlProps.defaultConfirmationPaneControlProps.confirmButtonText,
|
|
113
115
|
onClick: handleConfirmClick,
|
|
114
116
|
id: elementId + "-confirmbutton",
|
|
115
|
-
ariaLabel: ((_props$
|
|
116
|
-
})), !((_props$
|
|
117
|
+
ariaLabel: ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.confirmButtonAriaLabel) || _defaultConfirmationPaneControlProps.defaultConfirmationPaneControlProps.confirmButtonAriaLabel
|
|
118
|
+
})), !((_props$controlProps14 = props.controlProps) !== null && _props$controlProps14 !== void 0 && _props$controlProps14.hideCancelButton) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr4 = props.componentOverrides) === null || _props$componentOverr4 === void 0 ? void 0 : _props$componentOverr4.cancelButton) || /*#__PURE__*/_react2.default.createElement(_Button.DefaultButton, {
|
|
117
119
|
className: (_props$styleProps15 = props.styleProps) === null || _props$styleProps15 === void 0 || (_props$styleProps15 = _props$styleProps15.classNames) === null || _props$styleProps15 === void 0 ? void 0 : _props$styleProps15.cancelButtonClassName,
|
|
118
120
|
styles: cancelButtonStyles,
|
|
119
|
-
text: ((_props$
|
|
121
|
+
text: ((_props$controlProps15 = props.controlProps) === null || _props$controlProps15 === void 0 ? void 0 : _props$controlProps15.cancelButtonText) || _defaultConfirmationPaneControlProps.defaultConfirmationPaneControlProps.cancelButtonText,
|
|
120
122
|
onClick: handleCancelClick,
|
|
121
123
|
id: elementId + "-cancelbutton",
|
|
122
|
-
ariaLabel: ((_props$
|
|
124
|
+
ariaLabel: ((_props$controlProps16 = props.controlProps) === null || _props$controlProps16 === void 0 ? void 0 : _props$controlProps16.cancelButtonAriaLabel) || _defaultConfirmationPaneControlProps.defaultConfirmationPaneControlProps.cancelButtonAriaLabel
|
|
123
125
|
})))));
|
|
124
126
|
}
|
|
125
127
|
var _default = exports.default = ConfirmationPane;
|
|
@@ -13,6 +13,7 @@ const defaultConfirmationPaneControlProps = exports.defaultConfirmationPaneContr
|
|
|
13
13
|
titleText: _Constants.Texts.ConfirmationPaneTitle,
|
|
14
14
|
hideSubtitle: false,
|
|
15
15
|
subtitleText: _Constants.Texts.ConfirmationPaneSubtitle,
|
|
16
|
+
buttonGroupAriaLabel: _Constants.AriaLabels.ConfirmationPaneButtonGroup,
|
|
16
17
|
hideConfirmButton: false,
|
|
17
18
|
confirmButtonText: _Constants.Texts.ConfirmButtonText,
|
|
18
19
|
confirmButtonAriaLabel: _Constants.AriaLabels.ConfirmationPaneConfirm,
|
|
@@ -25,7 +25,7 @@ var _defaultInputValidationPaneTitleStyles = require("./common/default/defaultSt
|
|
|
25
25
|
var _utils = require("../../common/utils");
|
|
26
26
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
27
27
|
function InputValidationPane(props) {
|
|
28
|
-
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$controlProps12, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps0, _props$styleProps1, _props$styleProps10, _props$styleProps11, _props$styleProps12, _props$styleProps13, _props$styleProps14, _props$controlProps13, _props$styleProps15, _props$controlProps14, _props$controlProps15, _props$styleProps16, _props$controlProps16, _props$componentOverr, _props$styleProps17, _props$controlProps17, _props$controlProps18, _props$componentOverr2, _props$styleProps18, _props$controlProps19, _props$controlProps20, _props$componentOverr3, _props$styleProps19, _props$controlProps21, _props$controlProps22, _props$controlProps23, _props$componentOverr4, _props$styleProps20, _props$controlProps24, _props$controlProps25, _props$styleProps21, _props$controlProps26, _props$
|
|
28
|
+
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$controlProps12, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps0, _props$styleProps1, _props$styleProps10, _props$styleProps11, _props$styleProps12, _props$styleProps13, _props$styleProps14, _props$controlProps13, _props$styleProps15, _props$controlProps14, _props$controlProps15, _props$styleProps16, _props$controlProps16, _props$componentOverr, _props$styleProps17, _props$controlProps17, _props$controlProps18, _props$componentOverr2, _props$styleProps18, _props$controlProps19, _props$controlProps20, _props$componentOverr3, _props$styleProps19, _props$controlProps21, _props$controlProps22, _props$controlProps23, _props$componentOverr4, _props$styleProps20, _props$controlProps24, _props$controlProps25, _props$styleProps21, _props$controlProps26, _props$controlProps27, _props$componentOverr5, _props$styleProps22, _props$controlProps28, _props$controlProps29, _props$controlProps30, _props$controlProps31, _props$componentOverr6, _props$styleProps23, _props$controlProps32, _props$controlProps33, _props$controlProps34;
|
|
29
29
|
const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.id;
|
|
30
30
|
const [inputValue, setInputValue] = (0, _react2.useState)("");
|
|
31
31
|
const [isInitialRendering, setIsInitialRendering] = (0, _react2.useState)(true);
|
|
@@ -220,26 +220,28 @@ function InputValidationPane(props) {
|
|
|
220
220
|
className: (_props$styleProps21 = props.styleProps) === null || _props$styleProps21 === void 0 || (_props$styleProps21 = _props$styleProps21.classNames) === null || _props$styleProps21 === void 0 ? void 0 : _props$styleProps21.buttonGroupClassName,
|
|
221
221
|
styles: buttonGroupStyles,
|
|
222
222
|
tabIndex: -1,
|
|
223
|
-
id: elementId + "-buttongroup"
|
|
224
|
-
|
|
223
|
+
id: elementId + "-buttongroup",
|
|
224
|
+
role: "group",
|
|
225
|
+
"aria-label": ((_props$controlProps26 = props.controlProps) === null || _props$controlProps26 === void 0 ? void 0 : _props$controlProps26.buttonGroupAriaLabel) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.buttonGroupAriaLabel
|
|
226
|
+
}, !((_props$controlProps27 = props.controlProps) !== null && _props$controlProps27 !== void 0 && _props$controlProps27.hideSendButton) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr5 = props.componentOverrides) === null || _props$componentOverr5 === void 0 ? void 0 : _props$componentOverr5.sendButton) || /*#__PURE__*/_react2.default.createElement(_Button.PrimaryButton, {
|
|
225
227
|
className: (_props$styleProps22 = props.styleProps) === null || _props$styleProps22 === void 0 || (_props$styleProps22 = _props$styleProps22.classNames) === null || _props$styleProps22 === void 0 ? void 0 : _props$styleProps22.sendButtonClassName,
|
|
226
228
|
styles: sendButtonStyles,
|
|
227
|
-
title: ((_props$
|
|
229
|
+
title: ((_props$controlProps28 = props.controlProps) === null || _props$controlProps28 === void 0 ? void 0 : _props$controlProps28.sendButtonText) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.sendButtonText,
|
|
228
230
|
tabIndex: 0,
|
|
229
231
|
disabled: !isSendButtonEnabled,
|
|
230
|
-
text: ((_props$
|
|
232
|
+
text: ((_props$controlProps29 = props.controlProps) === null || _props$controlProps29 === void 0 ? void 0 : _props$controlProps29.sendButtonText) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.sendButtonText,
|
|
231
233
|
onClick: handleSendClick,
|
|
232
234
|
id: elementId + "-sendbutton",
|
|
233
|
-
ariaLabel: ((_props$
|
|
234
|
-
})), !((_props$
|
|
235
|
+
ariaLabel: ((_props$controlProps30 = props.controlProps) === null || _props$controlProps30 === void 0 ? void 0 : _props$controlProps30.sendButtonAriaLabel) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.sendButtonAriaLabel
|
|
236
|
+
})), !((_props$controlProps31 = props.controlProps) !== null && _props$controlProps31 !== void 0 && _props$controlProps31.hideCancelButton) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr6 = props.componentOverrides) === null || _props$componentOverr6 === void 0 ? void 0 : _props$componentOverr6.cancelButton) || /*#__PURE__*/_react2.default.createElement(_Button.DefaultButton, {
|
|
235
237
|
className: (_props$styleProps23 = props.styleProps) === null || _props$styleProps23 === void 0 || (_props$styleProps23 = _props$styleProps23.classNames) === null || _props$styleProps23 === void 0 ? void 0 : _props$styleProps23.cancelButtonClassName,
|
|
236
238
|
styles: cancelButtonStyles,
|
|
237
|
-
title: ((_props$
|
|
239
|
+
title: ((_props$controlProps32 = props.controlProps) === null || _props$controlProps32 === void 0 ? void 0 : _props$controlProps32.cancelButtonText) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.cancelButtonText,
|
|
238
240
|
tabIndex: 0,
|
|
239
|
-
text: ((_props$
|
|
241
|
+
text: ((_props$controlProps33 = props.controlProps) === null || _props$controlProps33 === void 0 ? void 0 : _props$controlProps33.cancelButtonText) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.cancelButtonText,
|
|
240
242
|
onClick: handleCancelClick,
|
|
241
243
|
id: elementId + "-cancelbutton",
|
|
242
|
-
ariaLabel: ((_props$
|
|
244
|
+
ariaLabel: ((_props$controlProps34 = props.controlProps) === null || _props$controlProps34 === void 0 ? void 0 : _props$controlProps34.cancelButtonAriaLabel) || _defaultInputValidationPaneControlProps.defaultInputValidationPaneControlProps.cancelButtonAriaLabel
|
|
243
245
|
})))));
|
|
244
246
|
}
|
|
245
247
|
var _default = exports.default = InputValidationPane;
|
|
@@ -22,6 +22,7 @@ const defaultInputValidationPaneControlProps = exports.defaultInputValidationPan
|
|
|
22
22
|
inputWithErrorMessageBorderColor: "rgb(164, 38, 44)",
|
|
23
23
|
invalidInputErrorMessageText: _Constants.Texts.InvalidInputErrorMessageText,
|
|
24
24
|
isButtonGroupHorizontal: true,
|
|
25
|
+
buttonGroupAriaLabel: _Constants.AriaLabels.InputValidationPaneButtonGroup,
|
|
25
26
|
hideSendButton: false,
|
|
26
27
|
enableSendButton: false,
|
|
27
28
|
sendButtonText: _Constants.Texts.SaveButtonText,
|
|
@@ -16,7 +16,7 @@ var _defaultPreChatSurveyPaneGeneralStyles = require("./common/defaultProps/defa
|
|
|
16
16
|
var _defaultPreChatSurveyPaneStyles = require("./common/defaultProps/defaultStyles/defaultPreChatSurveyPaneStyles");
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
18
|
function PreChatSurveyPane(props) {
|
|
19
|
-
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps0,
|
|
19
|
+
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _defaultPreChatSurvey, _props$styleProps0, _defaultPreChatSurvey2, _props$styleProps1, _defaultPreChatSurvey3, _props$styleProps10, _defaultPreChatSurvey4, _props$styleProps11, _defaultPreChatSurvey5, _props$styleProps12, _defaultPreChatSurvey6, _props$styleProps13, _defaultPreChatSurvey7, _props$styleProps14, _defaultPreChatSurvey8, _props$styleProps15, _defaultPreChatSurvey9, _props$styleProps16, _defaultPreChatSurvey0, _props$styleProps17, _defaultPreChatSurvey1, _props$styleProps18, _defaultPreChatSurvey10, _props$styleProps19, _defaultPreChatSurvey11, _props$styleProps20, _defaultPreChatSurvey12, _props$styleProps21, _defaultPreChatSurvey13, _props$controlProps6, _props$controlProps7, _props$controlProps8;
|
|
20
20
|
const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? _defaultPreChatSurveyPaneControlProps.defaultPreChatSurveyPaneControlProps.id;
|
|
21
21
|
let adpativeCardPayload;
|
|
22
22
|
let adaptiveCardHostConfig;
|
|
@@ -71,6 +71,22 @@ function PreChatSurveyPane(props) {
|
|
|
71
71
|
// Render the card
|
|
72
72
|
const renderedCard = adaptiveCard.render();
|
|
73
73
|
(0, _utils.addNoreferrerNoopenerTag)(renderedCard);
|
|
74
|
+
|
|
75
|
+
// Fix iOS Safari blank space in <select> dropdowns
|
|
76
|
+
if (renderedCard) {
|
|
77
|
+
const selectElements = renderedCard.querySelectorAll("select.ac-choiceSetInput-compact");
|
|
78
|
+
selectElements.forEach(select => {
|
|
79
|
+
// Remove hidden placeholder option that causes blank space on iOS
|
|
80
|
+
const firstOption = select.options[0];
|
|
81
|
+
if (firstOption && firstOption.disabled && firstOption.hidden && firstOption.value === "") {
|
|
82
|
+
select.removeChild(firstOption);
|
|
83
|
+
}
|
|
84
|
+
// Override iOS native select rendering
|
|
85
|
+
select.style.webkitAppearance = "none";
|
|
86
|
+
select.style.height = "auto";
|
|
87
|
+
select.style.minHeight = "31px";
|
|
88
|
+
});
|
|
89
|
+
}
|
|
74
90
|
return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
|
|
75
91
|
.ac-textBlock {
|
|
76
92
|
font-size: ${(_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 || (_props$styleProps3 = _props$styleProps3.customTextStyleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.fontSize} !important;
|
|
@@ -88,39 +104,52 @@ function PreChatSurveyPane(props) {
|
|
|
88
104
|
margin-bottom: 6px;
|
|
89
105
|
}
|
|
90
106
|
.ac-input.ac-textInput {
|
|
91
|
-
font-size: ${(_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 || (_props$styleProps9 = _props$styleProps9.customTextInputStyleProps) === null || _props$styleProps9 === void 0 ? void 0 : _props$styleProps9.fontSize};
|
|
92
|
-
font-family: ${((_props$styleProps0 = props.styleProps) === null || _props$styleProps0 === void 0 || (_props$styleProps0 = _props$styleProps0.customTextInputStyleProps) === null || _props$styleProps0 === void 0 ? void 0 : _props$styleProps0.fontFamily) ?? ((
|
|
93
|
-
height: ${((_props$styleProps1 = props.styleProps) === null || _props$styleProps1 === void 0 || (_props$styleProps1 = _props$styleProps1.customTextInputStyleProps) === null || _props$styleProps1 === void 0 ? void 0 : _props$styleProps1.height) ?? ((
|
|
107
|
+
font-size: ${((_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 || (_props$styleProps9 = _props$styleProps9.customTextInputStyleProps) === null || _props$styleProps9 === void 0 ? void 0 : _props$styleProps9.fontSize) ?? ((_defaultPreChatSurvey = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customTextInputStyleProps) === null || _defaultPreChatSurvey === void 0 ? void 0 : _defaultPreChatSurvey.fontSize)};
|
|
108
|
+
font-family: ${((_props$styleProps0 = props.styleProps) === null || _props$styleProps0 === void 0 || (_props$styleProps0 = _props$styleProps0.customTextInputStyleProps) === null || _props$styleProps0 === void 0 ? void 0 : _props$styleProps0.fontFamily) ?? ((_defaultPreChatSurvey2 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customTextInputStyleProps) === null || _defaultPreChatSurvey2 === void 0 ? void 0 : _defaultPreChatSurvey2.fontFamily)};
|
|
109
|
+
height: ${((_props$styleProps1 = props.styleProps) === null || _props$styleProps1 === void 0 || (_props$styleProps1 = _props$styleProps1.customTextInputStyleProps) === null || _props$styleProps1 === void 0 ? void 0 : _props$styleProps1.height) ?? ((_defaultPreChatSurvey3 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customTextInputStyleProps) === null || _defaultPreChatSurvey3 === void 0 ? void 0 : _defaultPreChatSurvey3.height)};
|
|
94
110
|
padding: 8px;
|
|
95
111
|
}
|
|
96
112
|
.ac-input.ac-textInput.ac-multiline {
|
|
97
|
-
font-size: ${(_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 || (_props$styleProps10 = _props$styleProps10.customMultilineTextInputStyleProps) === null || _props$styleProps10 === void 0 ? void 0 : _props$styleProps10.fontSize};
|
|
98
|
-
font-family: ${((_props$styleProps11 = props.styleProps) === null || _props$styleProps11 === void 0 || (_props$styleProps11 = _props$styleProps11.customMultilineTextInputStyleProps) === null || _props$styleProps11 === void 0 ? void 0 : _props$styleProps11.fontFamily) ?? ((
|
|
99
|
-
height: ${((_props$styleProps12 = props.styleProps) === null || _props$styleProps12 === void 0 || (_props$styleProps12 = _props$styleProps12.customMultilineTextInputStyleProps) === null || _props$styleProps12 === void 0 ? void 0 : _props$styleProps12.height) ?? ((
|
|
113
|
+
font-size: ${((_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 || (_props$styleProps10 = _props$styleProps10.customMultilineTextInputStyleProps) === null || _props$styleProps10 === void 0 ? void 0 : _props$styleProps10.fontSize) ?? ((_defaultPreChatSurvey4 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customMultilineTextInputStyleProps) === null || _defaultPreChatSurvey4 === void 0 ? void 0 : _defaultPreChatSurvey4.fontSize)};
|
|
114
|
+
font-family: ${((_props$styleProps11 = props.styleProps) === null || _props$styleProps11 === void 0 || (_props$styleProps11 = _props$styleProps11.customMultilineTextInputStyleProps) === null || _props$styleProps11 === void 0 ? void 0 : _props$styleProps11.fontFamily) ?? ((_defaultPreChatSurvey5 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customMultilineTextInputStyleProps) === null || _defaultPreChatSurvey5 === void 0 ? void 0 : _defaultPreChatSurvey5.fontFamily)};
|
|
115
|
+
height: ${((_props$styleProps12 = props.styleProps) === null || _props$styleProps12 === void 0 || (_props$styleProps12 = _props$styleProps12.customMultilineTextInputStyleProps) === null || _props$styleProps12 === void 0 ? void 0 : _props$styleProps12.height) ?? ((_defaultPreChatSurvey6 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customMultilineTextInputStyleProps) === null || _defaultPreChatSurvey6 === void 0 ? void 0 : _defaultPreChatSurvey6.height)};
|
|
100
116
|
resize: none;
|
|
101
117
|
}
|
|
102
118
|
.ac-input.ac-multichoiceInput {
|
|
103
|
-
font-size: ${(_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 || (_props$styleProps13 = _props$styleProps13.customMultichoiceInputStyleProps) === null || _props$styleProps13 === void 0 ? void 0 : _props$styleProps13.fontSize};
|
|
104
|
-
font-family: ${((_props$styleProps14 = props.styleProps) === null || _props$styleProps14 === void 0 || (_props$styleProps14 = _props$styleProps14.customMultichoiceInputStyleProps) === null || _props$styleProps14 === void 0 ? void 0 : _props$styleProps14.fontFamily) ?? ((
|
|
119
|
+
font-size: ${((_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 || (_props$styleProps13 = _props$styleProps13.customMultichoiceInputStyleProps) === null || _props$styleProps13 === void 0 ? void 0 : _props$styleProps13.fontSize) ?? ((_defaultPreChatSurvey7 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customMultichoiceInputStyleProps) === null || _defaultPreChatSurvey7 === void 0 ? void 0 : _defaultPreChatSurvey7.fontSize)};
|
|
120
|
+
font-family: ${((_props$styleProps14 = props.styleProps) === null || _props$styleProps14 === void 0 || (_props$styleProps14 = _props$styleProps14.customMultichoiceInputStyleProps) === null || _props$styleProps14 === void 0 ? void 0 : _props$styleProps14.fontFamily) ?? ((_defaultPreChatSurvey8 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customMultichoiceInputStyleProps) === null || _defaultPreChatSurvey8 === void 0 ? void 0 : _defaultPreChatSurvey8.fontFamily)};
|
|
105
121
|
padding: 3px;
|
|
106
122
|
padding-top: 7px;
|
|
107
123
|
padding-bottom: 7px;
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
}
|
|
126
|
+
.ac-input.ac-multichoiceInput.ac-choiceSetInput-compact {
|
|
127
|
+
height: auto;
|
|
128
|
+
min-height: 31px;
|
|
129
|
+
max-height: 45px;
|
|
130
|
+
-webkit-appearance: none;
|
|
131
|
+
appearance: none;
|
|
132
|
+
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
|
133
|
+
background-repeat: no-repeat;
|
|
134
|
+
background-position: right 8px center;
|
|
135
|
+
background-size: 16px;
|
|
136
|
+
padding-right: 30px;
|
|
108
137
|
}
|
|
109
138
|
.ac-input.ac-toggleInput {
|
|
110
|
-
align-items: ${((_props$styleProps15 = props.styleProps) === null || _props$styleProps15 === void 0 || (_props$styleProps15 = _props$styleProps15.customToggleInputStyleProps) === null || _props$styleProps15 === void 0 ? void 0 : _props$styleProps15.alignItems) ?? ((
|
|
139
|
+
align-items: ${((_props$styleProps15 = props.styleProps) === null || _props$styleProps15 === void 0 || (_props$styleProps15 = _props$styleProps15.customToggleInputStyleProps) === null || _props$styleProps15 === void 0 ? void 0 : _props$styleProps15.alignItems) ?? ((_defaultPreChatSurvey9 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customToggleInputStyleProps) === null || _defaultPreChatSurvey9 === void 0 ? void 0 : _defaultPreChatSurvey9.alignItems)} !important;
|
|
111
140
|
}
|
|
112
141
|
.ac-pushButton {
|
|
113
142
|
border: 1px solid #00000000;
|
|
114
143
|
margin: 2px;
|
|
115
|
-
height: ${((_props$styleProps16 = props.styleProps) === null || _props$styleProps16 === void 0 || (_props$styleProps16 = _props$styleProps16.customButtonStyleProps) === null || _props$styleProps16 === void 0 ? void 0 : _props$styleProps16.height) ?? ((
|
|
116
|
-
width: ${((_props$styleProps17 = props.styleProps) === null || _props$styleProps17 === void 0 || (_props$styleProps17 = _props$styleProps17.customButtonStyleProps) === null || _props$styleProps17 === void 0 ? void 0 : _props$styleProps17.width) ?? ((
|
|
144
|
+
height: ${((_props$styleProps16 = props.styleProps) === null || _props$styleProps16 === void 0 || (_props$styleProps16 = _props$styleProps16.customButtonStyleProps) === null || _props$styleProps16 === void 0 ? void 0 : _props$styleProps16.height) ?? ((_defaultPreChatSurvey0 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customButtonStyleProps) === null || _defaultPreChatSurvey0 === void 0 ? void 0 : _defaultPreChatSurvey0.height)};
|
|
145
|
+
width: ${((_props$styleProps17 = props.styleProps) === null || _props$styleProps17 === void 0 || (_props$styleProps17 = _props$styleProps17.customButtonStyleProps) === null || _props$styleProps17 === void 0 ? void 0 : _props$styleProps17.width) ?? ((_defaultPreChatSurvey1 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customButtonStyleProps) === null || _defaultPreChatSurvey1 === void 0 ? void 0 : _defaultPreChatSurvey1.width)};
|
|
117
146
|
border-radius: 5px;
|
|
118
147
|
cursor: pointer;
|
|
119
148
|
font-weight: bold;
|
|
120
|
-
font-size: ${((_props$styleProps18 = props.styleProps) === null || _props$styleProps18 === void 0 || (_props$styleProps18 = _props$styleProps18.customButtonStyleProps) === null || _props$styleProps18 === void 0 ? void 0 : _props$styleProps18.fontSize) ?? ((
|
|
121
|
-
font-family: ${((_props$styleProps19 = props.styleProps) === null || _props$styleProps19 === void 0 || (_props$styleProps19 = _props$styleProps19.customButtonStyleProps) === null || _props$styleProps19 === void 0 ? void 0 : _props$styleProps19.fontFamily) ?? ((
|
|
122
|
-
color: ${((_props$styleProps20 = props.styleProps) === null || _props$styleProps20 === void 0 || (_props$styleProps20 = _props$styleProps20.customButtonStyleProps) === null || _props$styleProps20 === void 0 ? void 0 : _props$styleProps20.color) ?? ((
|
|
123
|
-
background-color: ${((_props$styleProps21 = props.styleProps) === null || _props$styleProps21 === void 0 || (_props$styleProps21 = _props$styleProps21.customButtonStyleProps) === null || _props$styleProps21 === void 0 ? void 0 : _props$styleProps21.backgroundColor) ?? ((
|
|
149
|
+
font-size: ${((_props$styleProps18 = props.styleProps) === null || _props$styleProps18 === void 0 || (_props$styleProps18 = _props$styleProps18.customButtonStyleProps) === null || _props$styleProps18 === void 0 ? void 0 : _props$styleProps18.fontSize) ?? ((_defaultPreChatSurvey10 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customButtonStyleProps) === null || _defaultPreChatSurvey10 === void 0 ? void 0 : _defaultPreChatSurvey10.fontSize)};
|
|
150
|
+
font-family: ${((_props$styleProps19 = props.styleProps) === null || _props$styleProps19 === void 0 || (_props$styleProps19 = _props$styleProps19.customButtonStyleProps) === null || _props$styleProps19 === void 0 ? void 0 : _props$styleProps19.fontFamily) ?? ((_defaultPreChatSurvey11 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customButtonStyleProps) === null || _defaultPreChatSurvey11 === void 0 ? void 0 : _defaultPreChatSurvey11.fontFamily)};
|
|
151
|
+
color: ${((_props$styleProps20 = props.styleProps) === null || _props$styleProps20 === void 0 || (_props$styleProps20 = _props$styleProps20.customButtonStyleProps) === null || _props$styleProps20 === void 0 ? void 0 : _props$styleProps20.color) ?? ((_defaultPreChatSurvey12 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customButtonStyleProps) === null || _defaultPreChatSurvey12 === void 0 ? void 0 : _defaultPreChatSurvey12.color)};
|
|
152
|
+
background-color: ${((_props$styleProps21 = props.styleProps) === null || _props$styleProps21 === void 0 || (_props$styleProps21 = _props$styleProps21.customButtonStyleProps) === null || _props$styleProps21 === void 0 ? void 0 : _props$styleProps21.backgroundColor) ?? ((_defaultPreChatSurvey13 = _defaultPreChatSurveyPaneStyles.defaultPreChatSurveyPaneStyles.customButtonStyleProps) === null || _defaultPreChatSurvey13 === void 0 ? void 0 : _defaultPreChatSurvey13.backgroundColor)};
|
|
124
153
|
}`), !((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.hidePreChatSurveyPane) && /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
125
154
|
id: elementId,
|
|
126
155
|
tabIndex: -1,
|
|
@@ -5,5 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defaultPreChatSurveyPaneMultichoiceInputStyles = void 0;
|
|
7
7
|
const defaultPreChatSurveyPaneMultichoiceInputStyles = exports.defaultPreChatSurveyPaneMultichoiceInputStyles = {
|
|
8
|
+
fontSize: "16px",
|
|
8
9
|
fontFamily: "Segoe UI, Helvetica Neue, sans-serif"
|
|
9
10
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defaultPreChatSurveyPaneMultilineTextInputStyles = void 0;
|
|
7
7
|
const defaultPreChatSurveyPaneMultilineTextInputStyles = exports.defaultPreChatSurveyPaneMultilineTextInputStyles = {
|
|
8
|
+
fontSize: "16px",
|
|
8
9
|
height: "52px",
|
|
9
10
|
fontFamily: "Segoe UI, Helvetica Neue, sans-serif"
|
|
10
11
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defaultPreChatSurveyPaneTextInputStyles = void 0;
|
|
7
7
|
const defaultPreChatSurveyPaneTextInputStyles = exports.defaultPreChatSurveyPaneTextInputStyles = {
|
|
8
|
+
fontSize: "16px",
|
|
8
9
|
height: "20px",
|
|
9
10
|
fontFamily: "Segoe UI, Helvetica Neue, sans-serif"
|
|
10
11
|
};
|