selectbox onfocus="this.blur();" doesn't work as expected
Reported by
ilise...@gmail.com,
Jan 27 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 Steps to reproduce the problem: <select name="foo" onfocus="this.blur();"><option>1</option><option>2</option></select> What is the expected behavior? The user should not be able to open the select box. What went wrong? The user can expand the select box and select any of the options. Did this work before? N/A Chrome version: <Copy from: 'about:version'> Channel: n/a OS Version: 55.0.2883.87 (Official Build) (64-bit) Flash Version: Shockwave Flash 11.2 r202 If you are tempted to check the behavior of firefox, I can tell you that it works as expected. However new firefox versions >~50 (with multiprocess feature enabled), are having problems too (open bug 1334155, under investigation).
,
Jan 27 2017
Why don't you just use 'disabled' attribute to disable a popup menu?
,
Jan 27 2017
Unfortunately, 'disable' option doesn't post the value at all. I know that there are workarounds like adding a hidden field and copying the values to that, but that's another discussion. The onfocus="this.blur();" solution works with firefox and it's a very simple solution to implement a "readonly" feature (along with a css to fade the element). The thing is why it doesn't work on your browser and if it's a bug, it would be nice to fix it.
,
Jan 30 2017
For now, none of Chrome, Edge, Firefox, and Safari works as your expectation in this case, and the HTML standard doesn't define a behavior around this. So, I don't think we should change the behavior. preventDefault() for mousedown or click should work. Also, can you propose to add 'readonly' attribute to <select> on https://github.com/whatwg/html/issues ? |
|||
►
Sign in to add a comment |
|||
Comment 1 by nyerramilli@chromium.org
, Jan 27 2017