Skip to content

Commit

Permalink
fix(): bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasGysemans committed Apr 13, 2021
1 parent 6a102f8 commit cd76eae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/JSPanel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
/**
* @class Creates a panel that follows the digital accessibility recommendations
* @class Creates a panel that follows the digital accessibility recommendations.
*/
class JSPanel {
/**
Expand All @@ -19,9 +19,9 @@ class JSPanel {
this.button = button;
this.options = options;
this.panel_uniqueid = "jspanel-" + this._rand(0, 1000000);
this._buildPanel();
this.button.setAttribute("aria-expanded", "false");
this.button.setAttribute("aria-controls", this.panel_uniqueid);
this._buildPanel();
}
/**
* Builds the panel.
Expand Down Expand Up @@ -117,7 +117,7 @@ class JSPanel {
this._closePanel();
}
else {
this.button.setAttribute("expanded", "true");
this.button.setAttribute("aria-expanded", "true");
this.panel.classList.remove("panel-hidden");
}
}
Expand All @@ -128,7 +128,7 @@ class JSPanel {
*/
_closePanel() {
if (this.button && this.panel) {
this.button.setAttribute("expanded", "false");
this.button.setAttribute("aria-expanded", "false");
this.panel.classList.add("panel-hidden");
}
}
Expand Down Expand Up @@ -173,6 +173,7 @@ class JSPanel {
* Builds an item.
* @param {{title:string,icon?:string,fontawesome_icon?:string,onclick?:Function,separator?:boolean}} item The item to build.
* @returns {HTMLElement} The item as an HTML element.
* @private
*/
_buildItem(item) {
if (item.separator) {
Expand Down
4 changes: 2 additions & 2 deletions src/JSPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class JSPanel {
if (this._isOpened()) {
this._closePanel();
} else {
this.button.setAttribute("expanded", "true");
this.button.setAttribute("aria-expanded", "true");
this.panel.classList.remove("panel-hidden");
}
}
Expand All @@ -177,7 +177,7 @@ class JSPanel {
*/
private _closePanel(): void {
if (this.button && this.panel) {
this.button.setAttribute("expanded", "false");
this.button.setAttribute("aria-expanded", "false");
this.panel.classList.add("panel-hidden");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
cursor: pointer;
background-color: #fff;
border: 1px solid #dfe3eb;
box-shadow: 1px 2px 3px rgba(204, 204, 204, 0.75);
box-shadow: 0 0 3px rgba(204, 204, 204, 0.75);
color: #303030;
font-size: 22px;
transition: transform 200ms ease;
}

#panel-controller.visible {
#panel-controller[aria-expanded="true"] {
transform: rotate(45deg);
}
</style>
Expand Down
3 changes: 2 additions & 1 deletion src/panel-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 80%;
display: block;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
Expand Down

0 comments on commit cd76eae

Please sign in to comment.