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

onOpen and onClose event handlers for Select

Open vishnuvardhan-s opened this issue 2 years ago • 8 comments

Is your feature request related to a problem? Please describe. I have a use-case where I need to know if Select is open or not.

Describe the solution you'd like Event handlers like onOpen and onClose

Describe alternatives you've considered Passed an id to the Select say (select-id) and then used

document.getElementById('select-id')?.hasAttribute('opened')

vishnuvardhan-s avatar Sep 21 '22 03:09 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.

Lukas742 avatar Sep 21 '22 06:09 Lukas742

Hello @SAP/ui5-webcomponents-topic-p ,

The reporter wants new events called onOpen and onClose respectively when the Select is being opened/closed.

Currently this can be achieved if we listen for opened attribute change on the ui5-select tag/component with mutation observer.

Please decide whether or not this should be implemented.

Regards, Plamen Ivanov

plamenivanov91 avatar Sep 21 '22 07:09 plamenivanov91

I think this might be related to this other feature request for Menu: https://github.com/SAP/ui5-webcomponents/issues/5095

Maybe they could be considered together...

scameron avatar Sep 22 '22 05:09 scameron

Hi @scameron,

in order to continue with this feature request we would neee more information. Could you please provide more details about your use case especially with the ui5-select component?

Thanks! Dobrin

dobrinyonkov avatar Sep 28 '22 11:09 dobrinyonkov

Hi @dobrinyonkov,

You can refer to this issue for details about the use case, including screenshots of the behaviour we are trying to match: https://github.com/SAP/ui5-webcomponents/issues/5653.

There are comments near the bottom where @ilhan007 suggests a work-around that we want to try, but that work-around isn't possible unless we can detect the open/close state on the menu popover.

scameron avatar Sep 28 '22 12:09 scameron

Hi @scameron,

as far as I see #5653 is about ui5-menu component and additional "toggled" state/styles for the button opener. This feature reuqest is about the ui5-select component which always has the same opener (the internal "textfield") and its opened/toggled state is highlighted according to the Fiori Specifications:

image

Please correct me if I'm missing something here.

Kind Regards, Dobrin

dobrinyonkov avatar Sep 28 '22 13:09 dobrinyonkov

Hi @dobrinyonkov,

Yes, you're right, in our case we're not actually using Select, we're using Menu. When I saw this one I thought it looked the same as the feature request on the Menu side (https://github.com/SAP/ui5-webcomponents/issues/5095) so that it might make sense to consider these together.

If they are not related, apologies for the confusion. The one we need specifically for the workaround is the Menu.

Perhaps @vishnuvardhan-s can add something if there's another use case to consider more specifically for Select.

scameron avatar Sep 28 '22 14:09 scameron

My case goes like this. The toolbar dropdown should not collapse when Select is opened, it should stay open. So, the solution for this would be to know if the Select is open and take decision based on it, whether to keep the toolbar open or not programatically.

I have attached a video of the scenario for better understanding

https://user-images.githubusercontent.com/45058522/192818658-a92c5dda-39b0-4bdb-b436-2dbca139a9ac.mov

vishnuvardhan-s avatar Sep 28 '22 15:09 vishnuvardhan-s

Internal Reference: BGSOFUIPIRIN-6004

dobrinyonkov avatar Dec 14 '22 08:12 dobrinyonkov