Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set 'aria-expanded' to dropdwon combobox #11056

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions browser/src/control/Control.JSDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ L.Control.JSDialog = L.Control.extend({
console.warn('closePopover: no builder');
}
else {
JSDialog.CloseDropdown(id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it calls: L.Map.THIS.fire('jsdialog' which probably will land here again.
easy to do a cycle, does it work? do we have cypress test for closing popup using that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I do not have evidence failing unit test

// Need to change focus to last element before we clear the current dialog
this.focusToLastElement(id);
this.clearDialog(id);
Expand Down
10 changes: 9 additions & 1 deletion browser/src/control/Control.JSDialogBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2427,12 +2427,18 @@ L.Control.JSDialogBuilder = L.Control.extend({
});

div.closeDropdown = function() {
div.setAttribute('aria-expanded', false);
builder.callback('toolbox', 'closemenu', parentContainer, data.command, builder);
};
}

if (arrowbackground) {
div.setAttribute('aria-expanded', false);
}

var openToolBoxMenu = function(event, div) {
if (!div.hasAttribute('disabled')) {
div.setAttribute('aria-expanded', true);
builder.callback('toolbox', 'openmenu', parentContainer, data.command, builder);
event.stopPropagation();
}
Expand All @@ -2445,8 +2451,10 @@ L.Control.JSDialogBuilder = L.Control.extend({
builder.map.fire('postMessage', {msgId: 'Clicked_Button', args: {Id: data.id} });
else if (isRealUnoCommand && data.dropdown !== true)
builder.callback('toolbutton', 'click', button, data.command, builder);
else
else {
builder.callback('toolbox', 'click', parentContainer, data.command, builder);
button.setAttribute('aria-expanded', true);
}
}
e.preventDefault();
e.stopPropagation();
Expand Down
8 changes: 8 additions & 0 deletions browser/src/control/jsdialog/Util.Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ JSDialog.OpenDropdown = function (id, popupParent, entries, innerCallback, popup
]
};

this.popupParent = popupParent;
this.popupParent.setAttribute('aria-expanded', true);

var isChecked = function (unoCommand) {
var items = L.Map.THIS['stateChangeHandler'];
var val = items.getItemValue(unoCommand);
Expand Down Expand Up @@ -158,6 +161,11 @@ JSDialog.OpenDropdown = function (id, popupParent, entries, innerCallback, popup
};

JSDialog.CloseDropdown = function (id) {
if (this.popupParent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please avoid globals, we have menus with submenus :)
see calc -> conditional formatting

we need to save it inside instance

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cascade popups?. Let me see what can I do

this.popupParent.setAttribute('aria-expanded', false);
this.popupParent = null;
}

L.Map.THIS.fire('jsdialog', {data: {
id: _createDropdownId(id),
jsontype: 'dialog',
Expand Down
2 changes: 2 additions & 0 deletions browser/src/control/jsdialog/Widget.Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ JSDialog.combobox = function (parentContainer, data, builder) {
if (data.aria) {
content.setAttribute('aria-label',data.aria.label);
}
container.setAttribute('aria-haspopup', true);
container.setAttribute('aria-expanded', false);

var button = L.DomUtil.create('div', 'ui-combobox-button ' + builder.options.cssClass, container);
button.tabIndex = '0';
Expand Down
4 changes: 3 additions & 1 deletion browser/src/docstate.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,7 @@ if (activateValidation) {
window.app.file = new Proxy(window.app.file, validator);
}

window.JSDialog = {}; // initialize jsdialog module
window.JSDialog = {
popupParent : null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to avoid globals, just keep it in the instance

}; // initialize jsdialog module
window.SlideShow = {}; // initialize slideshow module