ardc-fair-checklist / ardc-fair-checklist.github.io

Self-assessment checklist for FAIR software
https://fairsoftwarechecklist.net
Apache License 2.0
1 stars 1 forks source link

Can select two radio buttons in one question #51

Closed jspaaks closed 1 year ago

jspaaks commented 1 year ago

Bug: I can sometimes select two radio buttons in one question. It seems to be related to going to GitHub or another site and clicking Back. This happens on desktop + Arch Linux + Edge. Reproduce with:

  1. go to data route
  2. select option 4 on the first question
  3. go to GitHub via link (in the same tab)
  4. click Back button
  5. now select option 3 on the first question
  6. now both options are checked

Also happens in the software route, also happens on desktop + Ubuntu + Firefox

update: the reproduce method doesn't work reliably

jspaaks commented 1 year ago

Maybe related: F5 refresh does not reset the state to all zeros

jspaaks commented 1 year ago

Seems solvable by pushing the URL including search parameters with the most recent state onto history onbeforeunload, something like in pages/software/v0.1/index.page.vue, within the onMounted():

window.onbeforeunload = () => {
    const preserve = [
        window.location.origin,
        window.location.pathname,
        `?${fairQueryParams.value}`
    ].join('');
    window.history.pushState({}, '', preserve);
};

Not sure it's good practice though, might lead to unexpected behavior when the user clicks goes back and forth through history.

jspaaks commented 1 year ago

Closing for now, haven't seen any problems with this of late.