Skip to content

Commit

Permalink
Fix Garnish.setFocusWithin() when the first focusable element is a ch…
Browse files Browse the repository at this point in the history
…eckbox

Resolves #11498
  • Loading branch information
brandonkelly committed Jun 24, 2022
1 parent 91136f6 commit 07af564
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed a bug where `Garnish.setFocusWithin()` wasn’t working if the first focusable element was a checkbox. ([#11498](https://github.com/craftcms/cms/discussions/11498))

## 3.7.45.2 - 2022-06-24

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/garnish/dist/garnish.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/garnish/dist/garnish.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/garnish/src/Garnish.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Garnish = $.extend(Garnish, {
* @param {Object} container The container element. Can be either an actual element or a jQuery collection.
*/
setFocusWithin: function (container) {
$(container).find(':focusable:first').focus();
$(container).find(':focusable:not(.checkbox):first').focus();
},

getFocusedElement: function () {
Expand Down

0 comments on commit 07af564

Please sign in to comment.