ui5-webcomponents-react icon indicating copy to clipboard operation
ui5-webcomponents-react copied to clipboard

[Popover]: Cannot use DOM reference as the opener of the popover.

Open allen138 opened this issue 1 year ago • 0 comments

Describe the bug

The opener support either a DOM id string, or a HTML Element DOM reference. However, the type is only defined as string. Please see: react Popover/index.tsx#L94 vs ui5-webcomponents Popover.ts#L174. In my scenario I would like to use a dom ref, but the types are failing with the following: image

As a workaround I tried something like

opener={(opener.current as unknown as string)}

But then it fails later as Valid opener id is required. since the dom reference is actually getting passed as a string to the webcomponent "[Object HTMLElement]".

Isolated Example

stackblitz sample

Reproduction steps

  1. Open the isolated example, and notice the ts compilation error
  2. Then, if you hack the type safety, notice the popover still does not open and you get the warning in the console. ...

Expected Behaviour

You should be able to use a dom ref as the opener for popovers.

UI5 Web Components for React Version

1.22.2

UI5 Web Components Version

1.19.1

Browser

Chrome

Organization

SF

Declaration

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

allen138 avatar Apr 02 '24 20:04 allen138