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

ELEMENTS-1714-BACKPORT: make document actions kebab menu usable with keyboard … #876

Merged
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
23 changes: 22 additions & 1 deletion ui/widgets/nuxeo-actions-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ import './nuxeo-tooltip.js';

<slot id="slot"></slot>
<div id="reparent"></div>
<paper-menu-button id="dropdownButton" close-on-activate no-overlap horizontal-align="right">
<paper-menu-button
id="dropdownButton"
close-on-activate
no-overlap
horizontal-align="right"
on-paper-dropdown-close="listnerRemove"
>
<paper-icon-button
id="iconButton"
icon="icons:more-vert"
Expand Down Expand Up @@ -199,8 +205,22 @@ import './nuxeo-tooltip.js';
el.removeAttribute('show-label');
}

_removeTabIndex(event) {
if (event.shiftKey && event.key === 'Tab') {
const dropDownList = this._getDropdownElements();
setTimeout(() => {
dropDownList.map((list) => list.removeAttribute('tabindex'));
}, 0);
}
}

listnerRemove() {
this.removeEventListener('keydown', this._removeTabIndex.bind(this));
}

_moveToDropdown(el) {
el.slot = 'dropdown';
el.addEventListener('keydown', this._removeTabIndex.bind(this));
/**
* XXX: in Chrome 100+, for some unknown reason, when moving action buttons to the dropdown menu
* and setting its visibility, messes up with any dialog that might be opened from clicking
Expand All @@ -209,6 +229,7 @@ import './nuxeo-tooltip.js';
*/
setTimeout(() => {
el.setAttribute('show-label', '');
el.removeAttribute('tabindex');
}, 0);
}

Expand Down
Loading