Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #25122
Closed
Open
Issue created Dec 29, 2017 by Administrator@rootContributor

Discrepancy between .active and :checked in radio button groups when going back to a page via browser history

Created by: prShadoko

I have noticed that when I press the "previous" button in my browser, the page is reloaded from cache and the item shown as .active is not the one I clicked last, but the one initially defined as .active in the DOM. This might not match with the actual radio buttons state as the :checked one is the last one clicked. Checkboxes have the same behavior in a similar setup.

I figured a way to overcome this by not using the .active class in the DOM and setting it according to the :checked states of radio buttons at page load.

See this fiddle for an example of the bug, and the temporary fix: https://jsfiddle.net/pr_shadoko/saymu7wa/7/

Tested on : Windows 10 64bit Chrome 63.0.3239.84 / Firefox 57.0 / Opera 49.0 jQuery 3.2.1 BS 4.0.0-beta.3 popper 1.12.9

Assignee
Assign to
Time tracking