aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorPatrick Toomey <ptoomey3@biasedcoin.com>2017-03-09 23:06:18 -0700
committerPatrick Toomey <ptoomey3@biasedcoin.com>2017-03-09 23:06:18 -0700
commit9ca712348e547815d04a6e1e13b9faf71ebce987 (patch)
treedda05f1c91dc19e8ef5a92e618a891af125a8e8a /.github
parent9f9e57339bb88fcf5f8e47a048d8201b97cd5f53 (diff)
downloadrails-9ca712348e547815d04a6e1e13b9faf71ebce987.tar.gz
rails-9ca712348e547815d04a6e1e13b9faf71ebce987.tar.bz2
rails-9ca712348e547815d04a6e1e13b9faf71ebce987.zip
Prevent event propogation if element is disabled when event chain begins.
The existing UJS event behavior relies on browsers not sending events for various events when an element is disabled. For example, imagine the following: <button type="submit" disabled="disabled">Click me</button> The above button is disabled, so browsers will not trigger a click event and all UJS behavior is prevented. However, imagine a button like this: <button type="submit" disabled="disabled"><strong>Click me</strong></button> The above is treated differently by browsers such as Chrome/Safari. These browsers do not consider the strong tag to be disabled, and will trigger click events. UJS has logic to walk up the DOM to find an associated element subject to UJS behavior. But, this logic does not take into account the disabled status of the element. I originally thought we could simply change the selectors used to match elements to ignore disabled elements. However, UJS disables some elements as part of the event chain. So, an element might match early in the chain and then fail to match later. Instead of changing the selectors I added a callback to the chain that calls `stopEverything` if an element is disabled when the event chain begins.
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions