Skip to content

Commit

Permalink
Add a random name attribute to the paper form.
Browse files Browse the repository at this point in the history
On reloading a page, Firefox fills in each control with the value
of "that control" from before the reload. Unfortunately, "that
control" is defined according to *order* in the form, not, e.g.,
`name` of control. That means that if, for example, the PC has
changed since the initial load, PC conflicts may be displaced!

Example: Initial PC conflicts:
   pcconf:1 [X]     pcconf:2 [ ]     pcconf:3 [X]     pcconf:4 [ ]
User 2 is removed from the PC; author reloads. Expected state:
   pcconf:1 [X]     pcconf:3 [X]     pcconf:4 [ ]
Actual state on FF (which fills in controls based on form order):
   pcconf:1 [X]     pcconf:3 [ ]     pcconf:4 [X]

Two PLDI2024 papers experienced this problem. A solution from
Stack Overflow is to set `autocomplete="off"` on the form. That
seems heavyweight and has additional consequences, e.g., preventing
browsers from filling in form entries on *history navigation*
(which is unproblematic). Another SO solution is to give the form
a random `name`, which appears to work.
  • Loading branch information
kohler committed Nov 30, 2023
1 parent 7a7d786 commit 9ed6452
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/papertable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,7 @@ private function _print_editable_form() {
}
$form_js = [
"id" => "f-paper",
"name" => base64_encode(random_bytes(8)), // prevent FF from incorrectly autofilling on reload
"class" => "need-unload-protection need-diff-check ui-submit js-submit-paper",
"data-differs-toggle" => "paper-alert"
];
Expand Down

0 comments on commit 9ed6452

Please sign in to comment.