Skip to content

Commit 5b28355

Browse files
- fixed failing test
1 parent d219d64 commit 5b28355

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

packages/main/src/ListItemBase.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,32 +165,29 @@ class ListItemBase extends UI5Element implements ITabbable {
165165
}
166166

167167
_onclick(e: MouseEvent) {
168-
if (this._isInteractiveContentClicked(e)) {
168+
if (this.getFocusDomRef()!.matches(":has(:focus-within)") || this._isDisabledInteractiveContentClicked(e)) {
169169
return;
170170
}
171171
this.fireItemPress(e);
172172
}
173173

174-
_isInteractiveContentClicked(e: MouseEvent): boolean {
175-
const focusDomRef = this.getFocusDomRef();
176-
if (!focusDomRef) {
177-
return false;
178-
}
179-
174+
_isDisabledInteractiveContentClicked(e: MouseEvent): boolean {
180175
const path = e.composedPath();
181-
const boundaryIndex = path.findIndex(target => target === this || target === focusDomRef);
182-
const relevantPath = boundaryIndex === -1 ? path : path.slice(0, boundaryIndex);
183176

184-
return relevantPath.some(target => {
177+
return path.some(target => {
185178
if (!(target instanceof HTMLElement)) {
186179
return false;
187180
}
188181

189-
if (target.matches("button, input, select, textarea, a[href], [contenteditable]:not([contenteditable='false'])")) {
190-
return true;
182+
if (target.matches("button, input, select, textarea")) {
183+
return (target as HTMLButtonElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement).disabled;
191184
}
192185

193-
return target.matches("ui5-button, ui5-link, ui5-input, ui5-textarea, ui5-select, ui5-combobox, ui5-multi-combobox, ui5-switch, ui5-checkbox, ui5-radio-button, ui5-date-picker, ui5-daterange-picker, ui5-time-picker, ui5-step-input");
186+
if (target.matches("ui5-button, ui5-input, ui5-textarea, ui5-select, ui5-combobox, ui5-multi-combobox, ui5-switch, ui5-checkbox, ui5-radio-button, ui5-date-picker, ui5-daterange-picker, ui5-time-picker, ui5-step-input")) {
187+
return !!(target as { disabled?: boolean }).disabled;
188+
}
189+
190+
return false;
194191
});
195192
}
196193

0 commit comments

Comments
 (0)