Alt txt for button

Please add an alt txt for the floating button

Hello there, @Gaby_Verdouw1 :waving_hand:

Great idea, thanks for sharing! We’ll try to consider this request in the future, especially if more users upvote it :slightly_smiling_face:

Just to clarify are you referring to the button aria-label ? Or do you want to add an image to your button and set image alt text?

If you’d like to set a custom aria-label, you can do this using the script below in the Custom JS field on the Settings tab of your widget’s settings

const REOPEN_BUTTON_ARIA_LABEL = 'Open contact form';

util.waitForElement('.es-forms-floating-button').then((el) => {
  const btn = el.matches('button') ? el : el.querySelector('button') || el;
  btn.setAttribute('aria-label', REOPEN_BUTTON_ARIA_LABEL);
});

The aria label can be changed in the 1st line of the script :slightly_smiling_face:

Thanks, you were inspirational. I also made a mouse-over, with a little help from AI.

const REOPEN_BUTTON_TEXT = ‘Open contactformulier’;

util.waitForElement(‘.es-forms-floating-button’).then((el) => {
const btn = el.matches(‘button’) ? el : el.querySelector(‘button’) || el;

// Voor toegankelijkheid (schermlezers)
btn.setAttribute(‘aria-label’, REOPEN_BUTTON_TEXT);

// Voor de mouse-over (tooltip)
btn.setAttribute(‘title’, REOPEN_BUTTON_TEXT);
});

Awesome, thank you for the feedback and for sharing the tweaked solution with a mouse-over :slightly_smiling_face: