Setting checked content attribute on radio input on click is applied after the default action
Reported by
ruc...@gmail.com,
Feb 21 2018
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36 Steps to reproduce the problem: 1. i have a form with several radio buttons layered out horizontally 2. when i select one it automatically selects the last one, regardless if i selected a different one 3. i have to select again so it selects the one i want What is the expected behavior? i should be able to select with one click the options i want What went wrong? chrome selects allways the last option on the first click Did this work before? N/A Does this work in other browsers? Yes Chrome version: 64.0.3282.167 Channel: n/a OS Version: 10.0 Flash Version:
,
Feb 22 2018
Hmm, I can't seem to reproduce the issue on my machine. Sending to Test Engineering team. Can you elaborate more on your environment/did you do anything after the page loaded before selecting an option?
,
Feb 22 2018
,
Feb 22 2018
You did not supply required JavaScript files, so your attachment works without a problem. My guess is that something in your JavaScript, or third party JavaScript files make this issue happen. Please, provide a standalone test package that will reproduce the issue out of the box, without any modification (otherwise there could be an unrelated problem in our reproduction instead of the problem that you are actually having).
,
Feb 22 2018
Hi Nothing else happens. Is a survey page that loads same way as others. Attached is a little video You can check in this url http://www.bbk.ac.uk/psychology/psychologyexperiments/experiments/thoughtsaffect/quests/quest3.php?r=1&p=5&d=3&dn=0&b=0&sst=2&sstl=0&m=9e119a2b38d5841b561b8eab334969b8 Thanks for looking into it Rubén
,
Feb 22 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Feb 22 2018
Interesting. Here is a reduced test case -
data:text/html,<!doctype html><script>window.addEventListener('click', function(){[...document.querySelectorAll('input')].forEach(function(item){item.setAttribute('checked', 'checked')});})</script><input type=radio name="a"><input type=radio name="a">
<!doctype html>
<script>
window.addEventListener('click', function()
{
[...document.querySelectorAll('input')].forEach(function(item)
{
item.setAttribute('checked', 'checked')
});
})
</script>
<input type=radio name="a">
<input type=radio name="a">
Looks like Chrome first checks a checkbox (commits the default action) and then runs the click handler (which applies setAttribute("checked", "checked") and thus setting the last one as checked). I guess it does not happen the second time because the value of the "checked" content attribute does not change, so no checkedness change is triggered.
,
Feb 22 2018
This strange behavior comes from "legacy-pre-activation behavior" https://html.spec.whatwg.org/multipage/input.html#the-input-element:legacy-pre-activation-behavior Safari's behavior is same as Chrome. I'll investigate more later.
,
Feb 23 2018
Edge agrees with Chrome and Safari, and the behavior matches to the standard. So, this is a bug of the web site. |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by sindhu.chelamcherla@chromium.org
, Feb 21 2018