Dropdown showOnFocus does not work

UI Components for React
Post Reply
WadeWilson
Posts: 8
Joined: 23 Jul 2023, 15:19

30 Jul 2023, 22:05

I want to show the options overlay on input focus (surprisingly it is not happening by default), looks like there is a property for that:

showOnFocus Property descriptions says "When enabled, overlay panel will be visible with input focus." - well, it's not. Here's example with active showOnFocus property, if you focus the input - nothing happens
https://codesandbox.io/s/primereact-dem ... src/App.js

there is a overlayVisible state item but there is not explanation on howto access\update it.

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

05 Aug 2023, 15:01

Its working fine for me. I just ran your Sandbox and focused the dropdown and it opens immediately.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

WadeWilson
Posts: 8
Joined: 23 Jul 2023, 15:19

06 Aug 2023, 22:30

Thank you for answer!

I assume you are doing focus with Tab button and not by just focusing the input by clicking on it? (here's recording https://youtu.be/SlH4qNEiYLw)
I was hoping this property covers both ways. If not maybe there is another one

michaelaskew
Posts: 2
Joined: 31 Jul 2023, 09:37

07 Aug 2023, 09:12

The "showOnFocus" functionality of the dropdown is not functioning as expected. When the dropdown is focused, it should display its options, but this behavior is not currently working as intended.

To troubleshoot and potentially resolve this issue, consider the following steps:

Check Code Implementation: Review the code implementation of the dropdown element. Ensure that the "showOnFocus" attribute or property is correctly set and assigned to the dropdown element.

Library or Framework Compatibility: If you are using a JavaScript library or framework to create the dropdown, ensure that the "showOnFocus" feature is supported by the version you are using. Check the documentation or community resources to verify compatibility.

Event Handling: Double-check that the appropriate event handlers are in place for the dropdown. The focus event should trigger the display of options. Verify that there are no conflicting event handlers or code that could interfere with the "showOnFocus" behavior.

CSS Styles: Inspect the CSS styles applied to the dropdown element. Ensure that there are no conflicting styles or positioning that could prevent the dropdown options from being displayed on focus.

WadeWilson
Posts: 8
Joined: 23 Jul 2023, 15:19

07 Aug 2023, 13:03

michaelaskew - it looks like you generated this message with ChatGPT, otherwise it's very confusing :)

At first it seems like you agree that reported bug does exists. But then you suggest to check my code implementation, framework compatibility or even CSS, despite the fact that I:
- added codesandbox link
- added youtube video
- specified why exaclty I believe there is a bug.

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

07 Aug 2023, 14:38

Yeah that is ChatGPT garbage.

Actually its because you have `editable` set so you can edit the dropdown then the dropdown will only drop if you click the arrow button. If you remove `editable` you will see it works as expected.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

WadeWilson
Posts: 8
Joined: 23 Jul 2023, 15:19

07 Aug 2023, 15:32

Thank you for answer!

But that was my point I want to show the options list the moment I focus the input and while I type text there and it filters out the options. Same way bootstrap does it
Image

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

07 Aug 2023, 16:12

Yep its all built into PrimeReact see: https://codesandbox.io/s/primereact-dem ... src/App.js

I just added the `filter` option and now it works just like Boostrap.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests