Skip to content

Commit

Permalink
fix: label click
Browse files Browse the repository at this point in the history
  • Loading branch information
palcarazm committed Dec 8, 2024
1 parent cce588b commit dae116c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/bootstrap5-toggle.ecmas.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ function sanitize(text) {
.forEach((label) => {
label.addEventListener(
"pointerdown",
(_e) => {
(e) => {
e.preventDefault();
this.toggle();
ecmasToggle.focus();
},
Expand Down
5 changes: 3 additions & 2 deletions js/bootstrap5-toggle.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,9 @@ function sanitize(text) {

if (this.$element.prop("id")) {
$('label[for="' + this.$element.prop("id") + '"]').on(
"pointerdown",
(_e) => {
"click touchstart",
(e) => {
e.preventDefault();
this.toggle();
this.$toggle.focus();
}
Expand Down

0 comments on commit dae116c

Please sign in to comment.