Skip to content

[patchPopup] target.closest is not a function #13783

Description

@KayKadner

Bug Description

the implementation of patchFocusEvent, which is applied via https://github.com/UI5/webcomponents/blob/v1.24.28/packages/base/src/features/patchPopup.ts is buggy as it causes on Firefox the abovementioned exception target.closest is not a function when a popup is open, the user navigates away from the window (e.g., address bar) and then focuses the popup again. Firefox first fires a focus event which is target ad the Document rather than the element and the document has no closest function

We see it happening on customer side:
Image

Affected Component

UI5/webcomponents/blob/v1.24.28/packages/base/src/features/patchPopup.ts

Expected Behaviour

no crash in this case

Isolated Example

https://jsfiddle.net/38vcnery/1/

Steps to Reproduce

go to https://jsfiddle.net/38vcnery/1/ . This is a very simple repo example

  1. navigate inside the rendering area, the exception happens

Log Output, Stack Trace or Screenshots

No response

Priority

No response

UI5 Web Components Version

1.24.28

Browser

Firefox

Operating System

No response

Additional Context

An additional check if for target instanceof Element prevents the crash

No response

Organization

SAP

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
New Issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions