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

Popover: Types for close() is wrong

Open vishnuvardhan-s opened this issue 1 year ago • 2 comments

Describe the bug

The types for close() method for the Popover is currently

// node_modules/@ui5/webcomponents-react/dist/webComponents/Popover/index.d.ts

close: () => void;

But when I debug, I can see it takes in three parameters

// node_modules/@ui5/webcomponents/dist/Popup.js

close(escPressed = false, preventRegistryUpdate = false, preventFocusRestore = false) {
...
}

I want my code to pass preventFocusRestore to false which I am currently not able to without using this syntax

((popoverRef.current as any)?.close)(false, false, true);

It would be great if the types are updated so that I don't have to typecast the ref to any

Isolated Example

https://stackblitz.com/edit/github-bdj64s?file=src%2FApp.tsx

Reproduction steps

...

Expected Behaviour

It should have the types of the arguments

Screenshots or Videos

No response

UI5 Web Components for React Version

1.26.2

UI5 Web Components Version

1.23.3

Browser

Chrome

Operating System

MacOS

Additional Context

No response

Relevant log output

No response

Organization

SAP

Declaration

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

vishnuvardhan-s avatar Jun 13 '24 03:06 vishnuvardhan-s

Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.


Hi colleagues,

it looks like not all parameters of of close() method of the Popover (inherited from Popup) are part of the custom element manifest: https://unpkg.com/browse/@ui5/[email protected]/dist/custom-elements-internal.json Line 12530 (Popover/onClose) and Line 12766 (Popup/onClose) have no parameters at all.

MarcusNotheis avatar Jun 13 '24 06:06 MarcusNotheis

Hi @vishnuvardhan-s,

These parameters are not described in the types since they are used internally. For preventing focus restore we provide property called preventFocusRestore to the ui5-popover (https://sap.github.io/ui5-webcomponents/components/Popover/#preventfocusrestore). Could you please check if this property will suite for your use case?

nnaydenow avatar Jun 25 '24 11:06 nnaydenow

Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!

github-actions[bot] avatar Jul 17 '24 00:07 github-actions[bot]

Thank you @nnaydenow! Closing the issue

vishnuvardhan-s avatar Jul 22 '24 10:07 vishnuvardhan-s