ui5-webcomponents
ui5-webcomponents copied to clipboard
onOpen and onClose event handlers for Select
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')
Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.
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
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...
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
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.
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:

Please correct me if I'm missing something here.
Kind Regards, Dobrin
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.
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
Internal Reference: BGSOFUIPIRIN-6004