Focus Event not working

Hi All, I created a View using coordinate container in my project (version 8.1.26). Then I added a dropdown and button component within a coordinate container. And then I added a onClick event in button as seen below.

And then I copied the same View into another project (version
8.1.18).

Both View should behave the same but in Version 8.1.26, focus() is not working while in 8.1.18, it works properly.

v8.1.26
8.26

v8.1.18
8.18hj

Not sure if it will help in this case. But I would personally move the script to the On Action Performed, as this is the proper button action, rather than clicking on the button object.

2 Likes

I tried moving the focus script from onClick to onActionPerformed event but it still wont expand the dropdown content
pos242

I can't replicate this "working" in 8.1.18. Could you copy the Coordinate Container node and paste the contents in a formatted snippet within this thread?

After speaking with a Dev, it's not terribly important to replicate at all in 8.1.18 because this was behavior we identified as "undesirable", and you're no longer seeing the behavior you expected because we purposely made the Dropdown send focus to the <input> piece of the component as part of 8.1.20 release (release notes). The original behavior (which you see in 8.1.18) would expand the Dropdown, but it is not common practice for Dropdowns to expand their options as they receive focus. In an effort to be more consistent, we no longer expand the options of the Dropdown when it receives focus.

As an exercise, you can examine the behavior of these forums for the expected/traditional behavior.

Click anywhere within the forum which is not a button/link, then press tab until you come to a field which is a dropdown. Note that the dropdown has not expanded, and instead requires you to press SPACE, or Enter/Return to expand the Dropdown.

1 Like

Hi @cmallonee , is there any other way I could expand the dropdown by clicking a sibling button ? TIA

did you try turning off the searable feature? as it looks like its trying to type in when you get focus

1 Like

@victordcq , I tried turning off the searchable property, but the dropdown still does not expand (show dropdown options) when I clicked on the sibling button with self.getSibling("Dropdown").focus() event.

As Cody notes, this is the correct behavior. It is not supposed to drop down on focus. That it did in the past is a bug that got fixed.

3 Likes

so what should I do to make it expanded all the time

Well, then it isn't a drop down at all. Consider using a table with row selection turned on.

1 Like

It won't look great. is there is an option like doClick() for button that makes the dropdown menu always expanded

But at least it will be right and standard GUI. What you're trying to do is just wrong.

Use the table as @pturmel suggested and style the table to look the same as the dropdown.

enableHeader : false
pager.top : false
pager.bottom : false
rows.striped.enabled : false
3 Likes

Not that I'm aware of. Keep in mind that this would have to be a browser feature, as Perspective just tells the browser to display a dropdown. You're really punching a brick wall, here.