Skip to content

Commit

Permalink
Merge pull request #314 from joselrio/ROU-4790
Browse files Browse the repository at this point in the history
ClearButton A11Y and Search Input disabled fixes
  • Loading branch information
gnbm authored Mar 9, 2024
2 parents a89cf25 + fc93d25 commit 27fa4c1
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 72 deletions.
2 changes: 1 addition & 1 deletion dist-archive/virtual-select-1.0.41.min.js

Large diffs are not rendered by default.

67 changes: 35 additions & 32 deletions dist/virtual-select.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/virtual-select.min.js

Large diffs are not rendered by default.

67 changes: 35 additions & 32 deletions docs/assets/virtual-select.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/virtual-select.min.js

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions src/virtual-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class VirtualSelect {
<div class="vscomp-arrow"></div>
<div class="vscomp-clear-button toggle-button-child" ${clearButtonTooltip}>
<div class="vscomp-clear-button toggle-button-child" ${clearButtonTooltip} tabindex="0" aria-label="clear button">
<i class="vscomp-clear-icon"></i>
</div>
</div>
Expand Down Expand Up @@ -430,7 +430,7 @@ export class VirtualSelect {
this.addEvent(document, 'click', 'onDocumentClick');
this.addEvent(this.$allWrappers, 'keydown', 'onKeyDown');
this.addEvent(this.$toggleButton, 'click', 'onToggleButtonClick');
this.addEvent(this.$clearButton, 'click', 'onClearButtonClick');
this.addEvent(this.$clearButton, 'click keydown', 'onClearButtonClick');
this.addEvent(this.$dropboxContainer, 'click', 'onDropboxContainerClick');
this.addEvent(this.$dropboxCloseButton, 'click', 'onDropboxCloseButtonClick');
this.addEvent(this.$optionsContainer, 'scroll', 'onOptionsScroll');
Expand Down Expand Up @@ -465,7 +465,7 @@ export class VirtualSelect {
this.removeEvent(document, 'click', 'onDocumentClick');
this.removeEvent(this.$allWrappers, 'keydown', 'onKeyDown');
this.removeEvent(this.$toggleButton, 'click', 'onToggleButtonClick');
this.removeEvent(this.$clearButton, 'click', 'onClearButtonClick');
this.removeEvent(this.$clearButton, 'click keydown', 'onClearButtonClick');
this.removeEvent(this.$dropboxContainer, 'click', 'onDropboxContainerClick');
this.removeEvent(this.$dropboxCloseButton, 'click', 'onDropboxCloseButtonClick');
this.removeEvent(this.$optionsContainer, 'scroll', 'onOptionsScroll');
Expand Down Expand Up @@ -573,8 +573,15 @@ export class VirtualSelect {
}
}

onClearButtonClick() {
this.reset();
onClearButtonClick(e) {
if (e.type === 'click') {
this.reset();
} else if (e.type === 'keydown') {
if (e.code === 'Enter' || e.code === 'Space') {
e.stopPropagation();
this.reset();
}
}
}

onOptionsScroll() {
Expand Down

0 comments on commit 27fa4c1

Please sign in to comment.