Skip to content

Commit 8eddb6c

Browse files
author
Hwashiang Yu
committed
MC-3709: Safari and firefox button grab handles display on multiple button items
- Updated logic to to set focus before setting active class - Renamed focusout method to onBlur and no longer extend from onMouseOut
1 parent c7b23ba commit 8eddb6c

File tree

3 files changed

+9
-9
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

3 files changed

+9
-9
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/button-item/preview.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/button-item/default/preview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77

8-
<div attr="data.main.attributes" ko-style="data.main.style" css="data.main.css" class="pagebuilder-content-type pagebuilder-button-item no-system-border focus-options" event="{ click: onButtonClick, focusout: onMouseOut }">
8+
<div attr="data.main.attributes" ko-style="data.main.style" css="data.main.css" class="pagebuilder-content-type pagebuilder-button-item no-system-border focus-options" event="{ click: onButtonClick, focusout: onBlur }">
99
<render args="getOptions().template" />
1010
<a attr="data.link.attributes" ko-style="data.link.style" css="data.link.css">
1111
<span class="button-item-drag-handle" css="{disabled: parent.parent.children().length <= 1}"></span>

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/button-item/preview.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,24 @@ export default class Preview extends BasePreview {
5555
// Ensure no other options panel and button drag handles are displayed
5656
$(".pagebuilder-content-type-active").removeClass("pagebuilder-content-type-active");
5757
$(".pagebuilder-options-visible").removeClass("pagebuilder-options-visible");
58-
const currentTarget = event.currentTarget;
58+
const currentTarget = $(event.currentTarget).closest("[data-element='main']")[0];
5959
let optionsMenu = $(currentTarget).find(".pagebuilder-options-wrapper");
6060

6161
if (!$(currentTarget).hasClass("type-nested")) {
6262
optionsMenu = optionsMenu.first();
6363
}
6464
optionsMenu.parent().addClass("pagebuilder-options-visible");
65-
$(currentTarget).addClass("pagebuilder-content-type-active");
6665
$(currentTarget).find("[data-element='link_text']").focus();
66+
$(currentTarget).addClass("pagebuilder-content-type-active");
6767
}
6868

6969
/**
70-
* Set state based on mouseout event for the preview
70+
* Set state based on blur event for the preview
7171
*
7272
* @param {Preview} context
7373
* @param {Event} event
7474
*/
75-
public onMouseOut(context: Preview, event: Event) {
75+
public onBlur(context: Preview, event: Event) {
7676
const currentTarget = event.currentTarget;
7777
let optionsMenu = $(currentTarget).find(".pagebuilder-options-wrapper");
7878

0 commit comments

Comments
 (0)