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
  • Merge requests
  • !30455

v4: Button checked state for back/refresh

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/icio/v4-button-input-change into v4-dev Mar 25, 2020
  • Overview 1
  • Commits 4
  • Pipelines 0
  • Changes 2

Created by: icio

Unlike any of the other browsers, Firefox will restore <input>s' checked status after a page refresh. (This behaviour can be suppressed with autocomplete=off on the form or input.) You can see this in action on 4.4.1 by selecting the last example radio then refreshing.

Other browsers and Firefox will restore the <inputs>s' checked status after navigating away from a page then navigating back. There's #25122 (closed) documenting this, which we can resolve by updating the initial button state on window pageshow as-well as load.

Trying to fix all of those things lead me to this PR, where button toggles with label/input rely on change events to update state, and .btn[data-toggle=button] remains handled by click events.

First PR here so feedback on testing/style/anything gratefully received.


I made the mistake of branching off v4-dev. Apologies ☺ Hopefully #28463 lands and v5 drops the requirement for JavaScript for this control, otherwise I can rebase onto master.

If a CSS-only alternative proves difficult, the toggle control could be far simpler if only label>input based markup is supported because we can then toggle the active class through the change event alone.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/icio/v4-button-input-change