Skip to content

Commit 449694f

Browse files
committed
# Conflicts: # CHANGELOG.md # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map # src/web/assets/garnish/dist/garnish.js # src/web/assets/garnish/dist/garnish.js.map
2 parents a5fb309 + 4e4e2e4 commit 449694f

8 files changed

Lines changed: 32 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Craft now sends no-cache headers for any request that calls `craft\web\Request::getCsrfToken()`. ([#15293](https://github.com/craftcms/cms/pull/15293), [#15281](https://github.com/craftcms/cms/pull/15281))
66
- Fixed a bug where structures’ Max Levels settings weren’t being enforced when dragging elements with collapsed descendants. ([#15310](https://github.com/craftcms/cms/issues/15310))
77
- Fixed a bug where `craft\helpers\ElementHelper::isDraft()`, `isRevision()`, and `isDraftOrRevision()` weren’t returning `true` if a nested draft/revision element was passed in, but the root element was canonical. ([#15303](https://github.com/craftcms/cms/issues/15303))
8+
- Fixed a bug where focus could be trapped within slideout sidebars. ([#15314](https://github.com/craftcms/cms/issues/15314))
89
- Fixed a bug where field status indicators weren’t visible on mobile viewports.
910
- Fixed a bug where sorting elements by custom field within element indexes wasn’t always working. ([#15297](https://github.com/craftcms/cms/issues/15297))
1011
- Fixed a bug where asset bulk element actions were available when folders were selected. ([#15301](https://github.com/craftcms/cms/issues/15301))

src/web/assets/cp/dist/cp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/dist/cp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/src/js/CpScreenSlideout.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
3939
ignoreFailedRequest: false,
4040
fieldsWithErrors: null,
4141

42+
get showExpandedView() {
43+
return this.$container.width() > 700;
44+
},
45+
4246
init: function (action, settings) {
4347
this.action = action;
4448
this.setSettings(settings, Craft.CpScreenSlideout.defaults);
@@ -344,7 +348,7 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
344348
this.hasSidebar = true;
345349

346350
// is the slideout wide enough to show it alongside the content?
347-
if (this.$container.width() > 700) {
351+
if (this.showExpandedView) {
348352
this.showSidebar();
349353
} else {
350354
this.hideSidebar();
@@ -435,7 +439,9 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
435439
});
436440
}
437441

438-
Craft.trapFocusWithin(this.$sidebar);
442+
if (!this.showExpandedView) {
443+
Craft.trapFocusWithin(this.$sidebar);
444+
}
439445

440446
this.$sidebarBtn.addClass('active').attr({
441447
'aria-expanded': 'true',
@@ -470,6 +476,8 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
470476
this.$sidebarBtn.focus();
471477
});
472478

479+
Craft.releaseFocusWithin(this.$sidebar);
480+
473481
this.$sidebarBtn.removeClass('active').attr({
474482
'aria-expanded': 'false',
475483
});

src/web/assets/cp/src/js/Craft.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,14 @@ $.extend(Craft, {
26252625
Garnish.trapFocusWithin(container);
26262626
},
26272627

2628+
/**
2629+
* Releases focus within a container.
2630+
* @param {Object} container
2631+
*/
2632+
releaseFocusWithin: function (container) {
2633+
Garnish.releaseFocusWithin(container);
2634+
},
2635+
26282636
/**
26292637
* Sets focus to the first focusable element within a container.
26302638
* @param {Object} container

src/web/assets/garnish/dist/garnish.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/garnish/dist/garnish.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/garnish/src/Garnish.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ Garnish = $.extend(Garnish, {
463463
*/
464464
trapFocusWithin: function (container) {
465465
const $container = $(container);
466+
this.releaseFocusWithin($container);
466467
$container.on('keydown.focus-trap', function (ev) {
467468
if (ev.keyCode === Garnish.TAB_KEY) {
468469
const $focusableElements = $container.find(':focusable');
@@ -484,6 +485,14 @@ Garnish = $.extend(Garnish, {
484485
});
485486
},
486487

488+
/**
489+
* Releases focus within a container.
490+
* @param {Object} container
491+
*/
492+
releaseFocusWithin: function (container) {
493+
$(container).off('.focus-trap');
494+
},
495+
487496
/**
488497
* Sets focus to the first focusable element within a container, or on the container itself.
489498
* @param {Object} container The container element. Can be either an actual element or a jQuery collection.

0 commit comments

Comments
 (0)