Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33370

Changing dropdown via keyboard doesn't update reactive parameters

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • active-choices-plugin
    • None
    • Jenkins 1.650, Active Choices plugin 1.4

      If you have an Active Choices parameter of type "dropdown", and you use the arrow keys to change the active selection, any dependant Reactive Reference Parameters don't get updated.

      The Reference Parameter only gets updated when you use the mouse to select an entry, even if it's the same one you already selected.

          [JENKINS-33370] Changing dropdown via keyboard doesn't update reactive parameters

          Successfully reproduced on Firefox 45.0. Happens only with Single select elements. Multi select works as expected.

          Bruno P. Kinoshita added a comment - Successfully reproduced on Firefox 45.0. Happens only with Single select elements. Multi select works as expected.

          From http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents

          *change*
          The change event occurs when a control loses the input focus and its value has been modified since gaining focus. This event is valid for INPUT, SELECT, and TEXTAREA. element.

          Bubbles: Yes
          Cancelable: No
          Context Info: None

          Bruno P. Kinoshita added a comment - From http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents * change * The change event occurs when a control loses the input focus and its value has been modified since gaining focus. This event is valid for INPUT, SELECT, and TEXTAREA. element. Bubbles: Yes Cancelable: No Context Info: None

          We are listening to the "change" event in the referenced parameter. But when you press keydown in a select, it doesn't fire a change event, only when you focus out.

          Bruno P. Kinoshita added a comment - We are listening to the "change" event in the referenced parameter. But when you press keydown in a select, it doesn't fire a change event, only when you focus out.

          Hi Dana!

          First of all, thanks for reporting the issue. It was successfully reproduced, and TL;DR, the fix was to simply change the script to bind to change+keyup.

          However, I found that by doing so, while testing with check boxes it wouldn't change the element selected, but the keyup (i.e. pressing any key while the check box is selected) would fire a call to update the elements.

          We could then:

          • Implement some extra logic in the callback to check whether the value changed since the last action
          • Or ignore that and let the extra calls happen

          Even though I'd like to add this feature, I think I wouldn't have enough time to write a proper good solution, with tests, and make sure that it works with no bad side effects. So am marking the ticket as Won't Fix simply for not having enough time to create the good solution (and not 100% sure it would work in all browsers and parameter types too [e.g. the custom HTML reference parameters]).

          In case you have a working solution for that, or any other suggestion, feel free to re-open this ticket or comment here.

          Bruno P. Kinoshita added a comment - Hi Dana! First of all, thanks for reporting the issue. It was successfully reproduced, and TL;DR, the fix was to simply change the script to bind to change+keyup. However, I found that by doing so, while testing with check boxes it wouldn't change the element selected, but the keyup (i.e. pressing any key while the check box is selected) would fire a call to update the elements. We could then: Implement some extra logic in the callback to check whether the value changed since the last action Or ignore that and let the extra calls happen Even though I'd like to add this feature, I think I wouldn't have enough time to write a proper good solution, with tests, and make sure that it works with no bad side effects. So am marking the ticket as Won't Fix simply for not having enough time to create the good solution (and not 100% sure it would work in all browsers and parameter types too [e.g. the custom HTML reference parameters] ). In case you have a working solution for that, or any other suggestion, feel free to re-open this ticket or comment here.

            kinow Bruno P. Kinoshita
            danagoyette Dana Goyette
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: