-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccessible Feedback Buttons.user.js
44 lines (35 loc) · 1.69 KB
/
Accessible Feedback Buttons.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ==UserScript==
// @name Accessible Feedback Buttons
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Makes thumbs up and thumbs down buttons accessible with proper announcements.
// @match https://elevenlabs.io/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to enhance accessibility of feedback buttons
function enhanceFeedbackButtons() {
const thumbsUpButton = document.querySelector('.flex-1.text-center svg[aria-hidden="true"]');
const thumbsDownButton = document.querySelector('.flex-1.text-center.ml-1 svg[aria-hidden="true"]');
if (thumbsUpButton) {
// Set aria-label to provide a descriptive label
thumbsUpButton.setAttribute('aria-label', 'Thumbs Up Feedback Button');
// Set aria-hidden to false to make it accessible
thumbsUpButton.setAttribute('aria-hidden', 'false');
// Apply tabindex for keyboard focus
thumbsUpButton.setAttribute('tabindex', '0');
}
if (thumbsDownButton) {
// Set aria-label to provide a descriptive label
thumbsDownButton.setAttribute('aria-label', 'Thumbs Down Feedback Button');
// Set aria-hidden to false to make it accessible
thumbsDownButton.setAttribute('aria-hidden', 'false');
// Apply tabindex for keyboard focus
thumbsDownButton.setAttribute('tabindex', '0');
}
}
// Call the enhanceFeedbackButtons function initially and set an interval to call it periodically
enhanceFeedbackButtons();
setInterval(enhanceFeedbackButtons, 1000); // Adjust the interval as needed
})();