diff --git a/src/common/copilot/assets/scripts/copilot.js b/src/common/copilot/assets/scripts/copilot.js index 813e39c7..328119ef 100644 --- a/src/common/copilot/assets/scripts/copilot.js +++ b/src/common/copilot/assets/scripts/copilot.js @@ -220,20 +220,20 @@ return feedback; } feedback.innerHTML = `
${copilotStrings.AI_CONTENT_MISTAKES_MESSAGE}
- -`; + + `; feedback.classList.add("feedback-div"); @@ -593,6 +593,7 @@ }); chatMessages.addEventListener("click", handleFeedbackClick); + chatMessages.addEventListener("keydown", handleFeedbackKeydown); function handleFeedbackClick(event) { const target = event.target; @@ -606,6 +607,20 @@ } } + function handleFeedbackKeydown(event) { + const target = event.target; + + if ((event.key === "Enter" || event.key === " ") && target.classList.contains("thumbsup")) { + event.preventDefault(); + handleThumbsUpClick(target); + } + + if ((event.key === "Enter" || event.key === " ") && target.classList.contains("thumbsdown")) { + event.preventDefault(); + handleThumbsDownClick(target); + } + } + function handleThumbsUpClick(element) { if (element.classList.contains("thumbsup-clicked")) {