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
  • #3465
Closed
Open
Issue created May 13, 2012 by Administrator@rootContributor

Modal "dismiss buttons" close the modal when pressing Enter in a form

Created by: wesley-murch

If you use a <button class="close" data-dismiss="modal">×</button> in a modal dialog (as shown in the docs), and that button is within a <form> element, pressing ENTER while focused on a form input will close the modal.

Demo: http://jsfiddle.net/CEpCj/4/

Focus on an input and press enter - the modal will close - even if the required fields are left blank. If they are valid, the form won't submit and the modal will still close. The expected behavior would be to submit the form and not close the modal.

A <button> with no type is an implied type="submit"; adding type="button" does fix the issue - but this still seems like unexpected behavior. It seems to be cross-browser.

Assignee
Assign to
Time tracking