diff --git a/packages/main/src/Panel.ts b/packages/main/src/Panel.ts index ff9ebba59eb9..3a13401b7f7d 100644 --- a/packages/main/src/Panel.ts +++ b/packages/main/src/Panel.ts @@ -10,6 +10,7 @@ import slideUp from "@ui5/webcomponents-base/dist/animations/slideUp.js"; import { isSpace, isEnter, isEscape } from "@ui5/webcomponents-base/dist/Keys.js"; import AnimationMode from "@ui5/webcomponents-base/dist/types/AnimationMode.js"; import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js"; +import { supportsTouch } from "@ui5/webcomponents-base/dist/Device.js"; import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js"; import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; import type { UI5CustomEvent } from "@ui5/webcomponents-base"; @@ -199,6 +200,9 @@ class Panel extends UI5Element { @property({ type: Boolean, noAttribute: true }) _pendingToggle = false; + @property({ type: Boolean }) + _touched = false; + /** * Defines the component header area. * @@ -232,6 +236,16 @@ class Panel extends UI5Element { return this.noAnimation || getAnimationMode() === AnimationMode.None; } + _isMobile() { + if (supportsTouch()) { + this._touched = true; + } + } + + _headerFocusOut() { + this._touched = false; + } + _headerClick(e: MouseEvent) { if (!this.shouldToggle(e.target as HTMLElement)) { return; diff --git a/packages/main/src/PanelTemplate.tsx b/packages/main/src/PanelTemplate.tsx index c6c845e9541d..3cfcb34e6de0 100644 --- a/packages/main/src/PanelTemplate.tsx +++ b/packages/main/src/PanelTemplate.tsx @@ -26,6 +26,8 @@ export default function PanelTemplate(this: Panel) { onClick={this._headerClick} onKeyDown={this._headerKeyDown} onKeyUp={this._headerKeyUp} + onTouchStart={this._isMobile} + onFocusOut={this._headerFocusOut} class="ui5-panel-header" tabindex={this.headerTabIndex} role={this.accInfo.role} diff --git a/packages/main/src/themes/Panel.css b/packages/main/src/themes/Panel.css index 7b4ba576cb99..59485534514b 100644 --- a/packages/main/src/themes/Panel.css +++ b/packages/main/src/themes/Panel.css @@ -59,10 +59,14 @@ right: var(--_ui5_panel_focus_offset); } -:host(:not([collapsed]):not([_has-header]):not([fixed])) .ui5-panel-header:focus:after { +:host(:not([collapsed]):not([_has-header]):not([fixed])) .ui5-panel-header:focus::after { border-radius: var(--_ui5_panel_border_radius_expanded); } +:host([_touched]:not([_has-header]):not([fixed])) .ui5-panel-header:focus::after { + display: none; +} + :host(:not([collapsed])) .ui5-panel-header-button:not(.ui5-panel-header-button-with-icon), :host(:not([collapsed])) .ui5-panel-header-icon-wrapper [ui5-icon] { transform: var(--_ui5_panel_toggle_btn_rotation);