Reduce some duplication when toggling "expanded" buttons in the viewer toolbars

This is very similar to PR 16281, but for buttons that use the "aria-expanded" attribute.
This commit is contained in:
Jonas Jenwald 2023-05-11 11:48:51 +02:00
parent d520754bcf
commit 362be760e3
4 changed files with 17 additions and 16 deletions

View file

@ -851,6 +851,13 @@ function toggleCheckedBtn(button, toggle, view = null) {
view?.classList.toggle("hidden", !toggle);
}
function toggleExpandedBtn(button, toggle, view = null) {
button.classList.toggle("toggled", toggle);
button.setAttribute("aria-expanded", toggle);
view?.classList.toggle("hidden", !toggle);
}
export {
animationStarted,
apiPageLayoutToViewerModes,
@ -891,6 +898,7 @@ export {
SpreadMode,
TextLayerMode,
toggleCheckedBtn,
toggleExpandedBtn,
UNKNOWN_SCALE,
VERTICAL_PADDING,
watchScroll,