diff --git a/packages/fiori/src/ShellBar.ts b/packages/fiori/src/ShellBar.ts index b5eb271f9e80..e84cd2f5638b 100644 --- a/packages/fiori/src/ShellBar.ts +++ b/packages/fiori/src/ShellBar.ts @@ -35,6 +35,7 @@ import type { ClassMap, AccessibilityAttributes, AriaRole, + UI5CustomEvent, } from "@ui5/webcomponents-base"; import type ListItemBase from "@ui5/webcomponents/dist/ListItemBase.js"; import type PopoverHorizontalAlign from "@ui5/webcomponents/dist/types/PopoverHorizontalAlign.js"; @@ -127,7 +128,7 @@ interface IShelBarItemInfo extends IShellBarHidableItem { title?: string, stableDomRef?: string, refItemid?: string, - press: (e: MouseEvent) => void, + press: (e: UI5CustomEvent) => void, order?: number, profile?: boolean, tooltip?: string, @@ -897,7 +898,7 @@ class ShellBar extends UI5Element { this._defaultItemPressPrevented = false; } - _handleCustomActionPress(e: MouseEvent) { + _handleCustomActionPress(e: UI5CustomEvent) { const target = e.target as HTMLElement; const refItemId = target.getAttribute("data-ui5-external-action-item-id"); @@ -916,7 +917,7 @@ class ShellBar extends UI5Element { this._toggleActionPopover(); } - _handleNotificationsPress(e: MouseEvent) { + _handleNotificationsPress(e: UI5CustomEvent) { const notificationIconRef = this.shadowRoot!.querySelector + ); + + cy.get("#b1") + .then($item => { + $item.get(0).addEventListener("ui5-click", e => e.preventDefault()); + $item.get(0).addEventListener("ui5-click", cy.stub().as("click")); + }); + + cy.get("form") + .then($item => { + $item.get(0).addEventListener("submit", e => e.preventDefault()); + $item.get(0).addEventListener("submit", cy.stub().as("submit")); + }); + + cy.get("#b1") + .realClick(); + + cy.get("#b1") + .realPress("Enter"); + + cy.get("#b1") + .realPress("Space"); + + cy.get("@click") + .should("have.been.calledThrice"); + + cy.get("@submit") + .should("have.not.been.called"); + }); + it("Normal button does not submit forms", () => { cy.mount(
diff --git a/packages/main/src/AvatarGroup.ts b/packages/main/src/AvatarGroup.ts index ada81165d1f4..e46f545aec70 100644 --- a/packages/main/src/AvatarGroup.ts +++ b/packages/main/src/AvatarGroup.ts @@ -3,6 +3,7 @@ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js"; import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js"; import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js"; import type { ITabbable } from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js"; +import type { UI5CustomEvent } from "@ui5/webcomponents-base"; import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; import property from "@ui5/webcomponents-base/dist/decorators/property.js"; @@ -190,8 +191,8 @@ class AvatarGroup extends UI5Element { * @since 2.0.0 * @default {} */ - @property({ type: Object }) - accessibilityAttributes: AvatarGroupAccessibilityAttributes = {}; + @property({ type: Object }) + accessibilityAttributes: AvatarGroupAccessibilityAttributes = {}; /** * @private @@ -433,7 +434,7 @@ class AvatarGroup extends UI5Element { e.stopPropagation(); } - onOverflowButtonClick(e: MouseEvent) { + onOverflowButtonClick(e: UI5CustomEvent) { e.stopPropagation(); this.fireDecoratorEvent("click", { diff --git a/packages/main/src/AvatarGroupTemplate.tsx b/packages/main/src/AvatarGroupTemplate.tsx index 7dcd62f22e1d..ca8bd06a1ad0 100644 --- a/packages/main/src/AvatarGroupTemplate.tsx +++ b/packages/main/src/AvatarGroupTemplate.tsx @@ -19,6 +19,7 @@ export default function AvatarGroupTemplate(this: AvatarGroup) { {this._customOverflowButton ? + // @ts-expect-error :