Add aria-haspopup attribute if button opens a popup.

Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: Ie305a48ab5509b52eb604eb73bdef042993b1083
This commit is contained in:
Gökay Şatır 2023-04-10 14:07:24 +03:00 committed by Gökay ŞATIR
parent 9d6296e4b3
commit ce9fa7d25b

View file

@ -2360,9 +2360,12 @@ L.Control.JSDialogBuilder = L.Control.extend({
div.tabIndex = -1;
var isRealUnoCommand = true;
var hasPopUp = false;
if (data.text)
if (data.text && data.text.endsWith('...')) {
data.text = data.text.replace('...', '');
hasPopUp = true;
}
if (data.command || data.postmessage === true) {
var id = data.id ? data.id : (data.command && data.command !== '') ? data.command : data.text;
@ -2392,6 +2395,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
button.id = buttonId;
button.setAttribute('alt', id);
builder._setAccessKey(button, builder._getAccessKeyFromText(data.text));
if (hasPopUp)
button.setAttribute('aria-haspopup', true);
var imagePath = (data.image && !isUnoCommand) ? data.image : icon;
var buttonImage = L.DomUtil.create('img', '', button);