Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui5-input): replace openPicker method with public property open #8950

Merged
merged 14 commits into from
May 28, 2024

Conversation

nikoletavnv
Copy link
Member

@nikoletavnv nikoletavnv commented May 13, 2024

Method openPicker of ui5-input is replaced with public property open

BREAKING CHANGE: Removed openPicker method and replaced it with public property open

Before, the ui5-input suggestions picker could be opened by calling openPicker() :

const input = document.getElementById("exampleID");
input.openPicker();

Now the suggestions picker is opened by setting the open property to true:

const input = document.getElementById("exampleID");
input.open = true;

You can now close the suggestions picker setting the open property to false:

 const input = document.getElementById("exampleID");
 input.open = false;

When the suggestion picker opens or closes internally, open and close events are fired. You can listen for those events like this:

const input = document.getElementById("exampleID");
input.addEventListener("open", (event) => {});
input.addEventListener("close", (event) => {});

Related to: #8461

BREAKING CHANGE: Remove openPicker method and replace it with public property open

Before the ui5-input suggestions popover could be opened by calling `openPicker()` :
```js
const input = document.getElementById("exampleID");
input.openPicker();
```

Now the suggestions popover is opened by setting the `open` property to true:
```js
const input = document.getElementById("exampleID");
input.open = true;
```
@vladitasev
Copy link
Contributor

I know this is still WIP, but adding a public open property in place of the old openPicker method has several implications:

  • please document that it's now also possible for the app to close the picker (by setting open=false) while there wasn't a closePicker method before
  • open is one of those properties that can be changed by both the app, and by user interaction internally (just like checked for ui5-checkbox f.e.). Therefore it requires a new event to go along with it, f.e. picker-open or similar. When the popover opens due to the user typing, you must fire this event so that the application can update its model, bound to the open property). Otherwise they'd be out of sync. This event should not be preventable

@MapTo0

Method openPicker of **ui5-input** is replaced with public property `open`

BREAKING CHANGE: Method `openPicker` is removed and replaced with public property `open`.

Before, the ui5-input suggestions picker could be opened by calling `openPicker()` :
```js
const input = document.getElementById("exampleID");
input.openPicker();
```

Now the suggestions picker is opened by setting the `open` property to true:
```js
const input = document.getElementById("exampleID");
input.open = true;
```

You can now close the suggestions picker setting the `open` property to false:
```js
const input = document.getElementById("exampleID");
input.open = false;
```

When the suggestion picker opens or closes internally, **open** and **close** events are fired.
You can listen for those events like this:

```js
const input = document.getElementById("exampleID");
input.addEventListener("open", (event) => {});
input.addEventListener("close", (event) => {});
```

Related to: #8461
@nikoletavnv nikoletavnv requested a review from ndeshev May 16, 2024 15:36
Copy link
Contributor

@elenastoyanovaa elenastoyanovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Screenshot 2024-05-17 at 14 16 24

if I am an app and set open=true, but no suggestions are loaded it will currently show an empty popover. I think that we were discussing for one of the input components that we do not want this. Can you research if we have some additional logic in the other inputs regarding this? I am not sure if the discussion was regarding UI5 or the components.

  1. In the sample "Input with open suggestions on focusin" if I click to open the dialog on mobile I am unable to close it. Even if I filter to show an item and click it, the suggestions are not closed.

packages/fiori/src/NotificationListGroupItem.ts Outdated Show resolved Hide resolved
@@ -425,6 +439,16 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
@property({ type: Boolean })
showClearIcon!: boolean;

/**
* Defines whether the suggestions picker is open.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you discussed with the central team what will be the behavior in a ui5-input is set to open and it is outside the viewport? Should we add additional comments here explaining the behavior?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have discussed that for now this is the expected behavior - if the input is outside the viewport its suggestions picker will be closed, as far as the component fires an event to notify the users that the suggestions picker is closed.

@simonarangelova
Copy link
Contributor

Method openPicker of ui5-input is replaced with public property open

BREAKING CHANGE: Removed openPicker method and replaced it with public property open

Before, the ui5-input suggestions picker could be opened by calling openPicker() :

const input = document.getElementById("exampleID");
input.openPicker();

Now the suggestions picker is opened by setting the open property to true:

const input = document.getElementById("exampleID");
input.open = true;

You can now close the suggestions picker setting the open property to false:

const input = document.getElementById("exampleID");
input.open = false;

When the suggestion picker opens or closes internally, open and close events are fired. You can listen for those events like this:

const input = document.getElementById("exampleID");
input.addEventListener("open", (event) => {});
input.addEventListener("close", (event) => {});

Related to: #8461

@ndeshev
Copy link
Contributor

ndeshev commented May 23, 2024

  1. In the sample "Input with open suggestions on focusin" if I click to open the dialog on mobile I am unable to close it. Even if I filter to show an item and click it, the suggestions are not closed.

I don't have an issue closing the dialog in that example (except that it can not be closed with 'ENTER), but if I choose an item and confirm it, then click again to open the dialog again and write some additional text I get this error:

image

packages/main/src/Input.ts Outdated Show resolved Hide resolved
nikoletavnv and others added 4 commits May 27, 2024 09:58
Method openPicker of `ui5-input` is replaced with public property `open`

**BREAKING CHANGE**: Removed `openPicker` method and replaced it with public property `open`
@ndeshev ndeshev dismissed elenastoyanovaa’s stale review May 28, 2024 12:00

Comments are applied

@nikoletavnv nikoletavnv merged commit 3e2b32e into main May 28, 2024
10 checks passed
@nnaydenow nnaydenow deleted the input-open branch May 28, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants