Skip to content

card edit button and focus #17105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a SQL error that could occur when executing an element query, if the `orderBy` param contained unexpected syntax.
- Fixed a bug where nested element cards could be missing their action menus if their “Max” setting had been reached. ([#17103](https://github.com/craftcms/cms/issues/17103))
- Fixed a bug where focus wasn’t always returned to the edit button, when closing an element editor slideout. ([#17099](https://github.com/craftcms/cms/issues/17099))
- Fixed styling issues. ([#17100](https://github.com/craftcms/cms/pull/17100), [#17098](https://github.com/craftcms/cms/issues/17098))

## 5.7.0 - 2025-04-15
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/Cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@ public static function elementCardHtml(ElementInterface $element, array $config
if ($cpEditUrl && Garnish.isCtrlKeyPressed(ev.originalEvent)) {
window.open($cpEditUrl);
} else {
// focus on the button so that when the slideout is closed, it's returned to the button
$(ev.currentTarget).focus();
Craft.createElementEditor($elementType, $settings);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/web/assets/cp/src/js/NestedElementManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ Craft.NestedElementManager = Garnish.Base.extend(
// Override the default event listener
$editBtn.off('activate');
this.addListener($editBtn, 'activate', (ev) => {
// focus on the button so that when the slideout is closed, it's returned to the button
$editBtn.focus();
const cpUrl = $element.data('cpUrl');
if (cpUrl && Garnish.isCtrlKeyPressed(ev.originalEvent)) {
window.open(cpUrl);
Expand Down