cuprite icon indicating copy to clipboard operation
cuprite copied to clipboard

BUG: select actions does not trigger "input" events (only "change" event) on select inputs/dropdowns

Open cgaube opened this issue 2 years ago • 0 comments

Context

When a user change/select the value (option) of a dropdown input :

<label for="test">Trigger events</label>
<select name="test" id="test">
  <option>A</option>
  <option>B</option>
</select>

<script>
const selectInput = document.getElementById('test');

selectInput.addEventListener('change', () => console.log('CHANGE EVENT TRIGGERED));
selectInput.addEventListener('input', () => console.log('input EVENT TRIGGERED));
</script>

in test:

select 'B', from:"Trigger events" 

it does not trigger the input event , but correctly triggers the change event https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event

Looking at the code i think we are missing a line that also triggers a input event in addition to that change event

https://github.com/rubycdp/cuprite/blob/c7dc979350295f29630ad6dba35227c5d8a707fc/lib/capybara/cuprite/javascripts/index.js#L363-L380

cgaube avatar Jan 06 '23 17:01 cgaube