0

in my r Shiny app I have a simple select selectinput widget:

selectInput("select_a_name", 
  selectize = FALSE,
  label = "Select Name",
  choices = names_active_reactive$names,
  multiple = FALSE,
  selected = selected_name,
  size = 25)

The user is selecting one name from a long vector of names (names_active_reactive$names, over 100 long). Notice that that vector is a reactive value - this seems to be the issue.

I have enough real estate on the screen, and so I allow the user to see quite a few names, which is why I set size = 25.

So, when the user wants to select, for example, user 50, s/he has to use the scrolling bar on the right side of the window until s/he finds user 50 and select that user. As a result, user 50 is selected and selectinput window shows 25 names whereby the currently selected user (#50) is at the very bottom of the window.

If the user wants to see the names of a few more users after 50 (e.g., users 51-65), s/he has to scroll further down. Let's say the user clicks on another name in the middle of the window (user 60). In this case, that name becomes selected but immediately shifts to the very bottom of the widget window! And names 61+ are not visible anymore.

I wonder if it is at all possible to get rid of that widget behavior that forces the selected element in the list to appear always at the very bottom of the window.

Notice, that this problem doesn't exist when the choices are a fixed list. But it emerges when the choices are reactive Values.

And a bonus question: is it in any way possible to allow the user to scroll down the list of names in the window using "arrow down" on the keyboard?

Thank you very much!

user3245256
  • 1,842
  • 4
  • 24
  • 51
  • I'm having trouble reproducing this behavior. Is it possible to add a reproducible example? – Ryan Morton Sep 29 '19 at 20:20
  • I'll try. Are you saying that in your case it's not jumping so that the highlighted row is the last one? Let me check, maybe this only happens on this Windows Surface... – user3245256 Sep 30 '19 at 13:46
  • I have to produce an example. In the meantime, I tested it on a regular Windows PC - not surface. Same thing is happening. The highlighted name is always shown as the last (bottom) one in the window. – user3245256 Sep 30 '19 at 13:56
  • I'm not seeing any "jumping" at all. Are you rendering the UI or is the UI static? – Ryan Morton Sep 30 '19 at 14:06
  • I created a simple example (where the list of the names to be shown is not a reactive value but a fixed list). And then the problem is gone. It looks like the issue is that my list of names shown in the pull-down is a reactiveValue – user3245256 Sep 30 '19 at 14:23
  • @RyanMorton Yes, I am running renderUI on the server side. So, my filter (selectInput) is inside my render UI statement + choices are reactiveValues and the current selection (selected_name) is also based on a reactive value. – user3245256 Sep 30 '19 at 14:30
  • I agree the reactivity is probably the issue. Every time an input changes inside the reactive space, the widget updates/jumps too – Ryan Morton Sep 30 '19 at 14:46

0 Answers0