question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

event.target.selectedOptions IE Bug

See original GitHub issue

Currently the synthetic event fired from select element’s onChange prop has no selectedOptions property in IE11 (most likely earlier versions as well). event.nativeEvent.srcElement.value appears to work in all browsers.

This works in Chrome:

event.target.selectedOptions[0].value. 

In IE:

event.target.selectedOptions === undefined;

Can this be polyfilled to be consistent across browsers or is the assumption developers should use event.nativeEvent.srcElement.value?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
sophiebitscommented, Jan 7, 2016

(Sounds like you want event.target.value.)

0reactions
jimfbcommented, Jan 7, 2016

Ok, I ran the fiddle in IE11. Best as I can tell, event.nativeEvent.srcElement === event.target, and is the DOM node. It looks like IE11 no longer supports selectedOptions on the select DOM node, which is odd because it appears to be supported by Edge, but that’s life. selectedOptions is not part of the spec, and even if it were, I don’t think we’d want to be polyfilling the actual dom nodes.

Anyway, I think this has nothing to do with our synthetic events. The “problem” is occurring when the browser reads directly from a DOM node. Unless I’m missing something, no further action is necessary here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

event.target.selectedOptions IE Bug - JSFiddle
The fiddle listings (Public, Private, Titled, etc) will now display latest versions instead of the ones saved as Base versions - this was...
Read more >
React currentTarget.selectedOptions[0].value is failing in IE 10 ...
One question - I looked for other ways and found this one - just using event.target.value per stackoverflow.com/a/28868135/2532070 Both appear ...
Read more >
HTMLSelectElement.selectedOptions - Web APIs | MDN
This script sets up a click event listener on the "Order Now" button. When clicked, the event handler fetches the list of selected...
Read more >
How To Handle Dropdowns In Selenium WebDriver Using ...
While dealing with access forms, you'd often have to handle dropdown. Here's how you can handle them with Selenium WebDriver in Selenium ...
Read more >
API - React Select
If you wish to overwrite a component, pass in an object with the appropriate namespace. ... Whether to block scroll events when the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found